Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4886/src/bossa/syntax
Modified Files:
NiceClass.java
Log Message:
Use the type parameter list, not the binders list, when constructing
constructors based on parent constructors (fixes #892041).
Index: NiceClass.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -d -r1.79 -r1.80
*** NiceClass.java 4 Mar 2004 12:56:28 -0000 1.79
--- NiceClass.java 4 Mar 2004 15:48:21 -0000 1.80
***************
*** 690,698 ****
private List getParentConstructorParameters
! (List constraints, TypeSymbol[] binders)
{
TypeScope scope = Node.getGlobalTypeScope();
Map map = null;
! if (binders != null)
{
// Constructs a type scope that maps the type parameters of this
--- 690,698 ----
private List getParentConstructorParameters
! (List constraints, mlsub.typing.Monotype[] typeParameters)
{
TypeScope scope = Node.getGlobalTypeScope();
Map map = null;
! if (typeParameters != null)
{
// Constructs a type scope that maps the type parameters of this
***************
*** 700,708 ****
scope = new TypeScope(scope);
map = new HashMap();
! TypeSymbol[] ourBinders = definition.getBinders();
! for (int i = 0; i < binders.length; i++)
try {
! scope.addMapping(ourBinders[i].toString(), binders[i]);
! map.put(ourBinders[i], binders[i]);
} catch(TypeScope.DuplicateName e) {}
}
--- 700,711 ----
scope = new TypeScope(scope);
map = new HashMap();
! mlsub.typing.Monotype[] ourTypeParameters =
! definition.getTypeParameters();
! for (int i = 0; i < ourTypeParameters.length; i++)
try {
! TypeSymbol ourSym = asTypeSymbol(ourTypeParameters[i]);
! TypeSymbol sym = asTypeSymbol(typeParameters[i]);
! scope.addMapping(ourSym.toString(), sym);
! map.put(ourSym, sym);
} catch(TypeScope.DuplicateName e) {}
}
***************
*** 734,738 ****
}
! private List getConstructorParameters(List constraints, TypeSymbol[] binders)
{
TypeConstructor supTC = definition.getSuperClass();
--- 737,750 ----
}
! private TypeSymbol asTypeSymbol(mlsub.typing.Monotype type)
! {
! if (type instanceof TypeSymbol)
! return (TypeSymbol) type;
! else
! return ((MonotypeConstructor) type).getTC();
! }
!
! private List getConstructorParameters(List constraints,
! mlsub.typing.Monotype[] typeParameters)
{
TypeConstructor supTC = definition.getSuperClass();
***************
*** 743,747 ****
res = getNativeConstructorParameters(supTC, constraints);
else
! res = sup.getParentConstructorParameters(constraints, binders);
if (overrides.length > 0)
--- 755,759 ----
res = getNativeConstructorParameters(supTC, constraints);
else
! res = sup.getParentConstructorParameters(constraints, typeParameters);
if (overrides.length > 0)
***************
*** 807,811 ****
constraints = new LinkedList();
! List allConstructorParams = getConstructorParameters(constraints, binders);
Constraint cst;
--- 819,826 ----
constraints = new LinkedList();
! mlsub.typing.Monotype[] typeParameters = definition.getTypeParameters();
!
! List allConstructorParams =
! getConstructorParameters(constraints, typeParameters);
Constraint cst;
|