Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv14791/src/bossa/syntax
Modified Files:
SuperExp.java
Log Message:
Handle polymorphic methods where super was defined in a Java superclass
(closes #750422).
Index: SuperExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/SuperExp.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SuperExp.java 5 Jun 2003 16:06:03 -0000 1.9
--- SuperExp.java 9 Jun 2003 22:12:31 -0000 1.10
***************
*** 18,21 ****
--- 18,22 ----
import gnu.bytecode.*;
import mlsub.typing.*;
+ import nice.tools.code.Types;
import mlsub.typing.Polytype;
***************
*** 132,145 ****
else
{
! TypeConstructor superTC = findTCforClass
! (currentMethod.firstArgument(),
! superMethod.getDeclaringClass());
if (superTC == null)
{
- // This probably means that super comes from a special
- // class that is not in the Nice hierarchy, like
- // java.lang.Object (because of variances).
-
// Our safe bet is to assert that the argument is
// above Object
--- 133,144 ----
else
{
! TypeConstructor superTC = null;
! try {
! superTC = Types.typeConstructor(superMethod.getDeclaringClass());
! }
! catch(Types.NotIntroducedClassException ex ) {}
if (superTC == null)
{
// Our safe bet is to assert that the argument is
// above Object
***************
*** 177,193 ****
return new Constraint(c.binders(), newAtoms);
- }
-
- private static TypeConstructor findTCforClass(TypeConstructor tc,
- ClassType t)
- {
- if (nice.tools.code.Types.get(tc) == t)
- return tc;
-
- TypeConstructor superClass = ClassDefinition.get(tc).getSuperClass();
- if (superClass != null)
- return findTCforClass(superClass, t);
-
- return null;
}
--- 176,179 ----
|