[gcjx] Patch: FYI: type inference fixes

Tom Tromey tromey@redhat.com
Fri Oct 28 20:05:00 GMT 2005


I'm checking this in on the gcjx branch.

This fixes a couple of bugs in the type inference code.  These were
found by running gcjx on the classpath generics branch.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* unify.cc (unifier::compute_lcta): Handle case of two unbound
	wildcards.
	(unifier::unify): Handle case where 'actual' is a raw type.
	(unifier::compute_super_types): Resolve classes of 'klass'.

Index: unify.cc
===================================================================
--- unify.cc	(revision 105944)
+++ unify.cc	(working copy)
@@ -85,6 +85,7 @@
   {
     while (klass != NULL)
       {
+	klass->resolve_classes ();
 	st.insert (klass);
 	est.insert (assert_cast<model_class *> (klass->erasure ()));
 	std::list<ref_forwarding_type> ifaces (klass->get_interfaces ());
@@ -215,6 +216,12 @@
 	    else
 	      result = new model_wildcard (where);
 	  }
+	// FIXME: not sure if next 2 cases are correct.
+	else if (lbound == NULL)
+	  result = rightw;
+	else if (rbound == NULL)
+	  result = leftw;
+	// END FIXME
 	else
 	  result = new model_wildcard (where, compute_lub (lbound, rbound));
       }
@@ -362,7 +369,8 @@
 	return;
       }
 
-    if (! formal->parameterized_p ())
+    // Note that ACTUAL could be a raw type here.
+    if (! formal->parameterized_p () || ! actual->parameterized_p ())
       {
 	// No constraint implied.
 	return;



More information about the Java-patches mailing list