[Nice-commit] Nice/src/bossa/syntax MethodContainer.java,1.15,1.16
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-07-16 10:02:12
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9811/src/bossa/syntax Modified Files: MethodContainer.java Log Message: When there is a class constraint, report undeclared class type parameters. Index: MethodContainer.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodContainer.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MethodContainer.java 25 Feb 2004 11:23:29 -0000 1.15 --- MethodContainer.java 16 Jul 2004 10:01:33 -0000 1.16 *************** *** 18,21 **** --- 18,22 ---- import mlsub.typing.TypeConstructor; import bossa.util.User; + import bossa.util.Location; import java.util.List; *************** *** 79,83 **** */ public static Constraint make(bossa.syntax.Constraint cst, ! MonotypeVar[] typeParameters, List atoms) { TypeSymbol[] binders; --- 80,85 ---- */ public static Constraint make(bossa.syntax.Constraint cst, ! MonotypeVar[] typeParameters, List atoms, ! Location loc) { TypeSymbol[] binders; *************** *** 98,110 **** } ! return new Constraint(binders, constraints, typeParameters, resolve); } ! private Constraint (TypeSymbol[] binders, List atoms, ! MonotypeVar[] typeParameters, boolean resolve) { super(binders, atoms); if (resolve) ! findBinders(typeParameters); else this.typeParameters = typeParameters; --- 100,114 ---- } ! return new Constraint ! (binders, constraints, typeParameters, resolve, loc); } ! private Constraint (TypeSymbol[] binders, List atoms, ! MonotypeVar[] typeParameters, boolean resolve, ! Location loc) { super(binders, atoms); if (resolve) ! findBinders(typeParameters, loc); else this.typeParameters = typeParameters; *************** *** 119,134 **** constraint by their definition. */ ! private void findBinders(MonotypeVar[] typeParameters) { this.typeParameters = new mlsub.typing.Monotype[typeParameters.length]; ! for (int i = 0; i < typeParameters.length; i++) { ! this.typeParameters[i] = findBinder(typeParameters[i]); } } ! private mlsub.typing.Monotype findBinder(MonotypeVar binder) { ! for (java.util.Iterator i = this.getBinders().iterator(); i.hasNext(); ) { TypeSymbol s = (TypeSymbol) i.next(); --- 123,138 ---- constraint by their definition. */ ! private void findBinders(MonotypeVar[] typeParameters, Location loc) { this.typeParameters = new mlsub.typing.Monotype[typeParameters.length]; ! for (int i = 0; i < typeParameters.length; i++) { ! this.typeParameters[i] = findBinder(typeParameters[i], loc); } } ! private mlsub.typing.Monotype findBinder(MonotypeVar binder, Location loc) { ! for (java.util.Iterator i = this.getBinders().iterator(); i.hasNext(); ) { TypeSymbol s = (TypeSymbol) i.next(); *************** *** 145,150 **** } ! // Not found. It was not introduced earlier, use it as the binder. ! return binder; } --- 149,153 ---- } ! throw User.error(loc, binder + " is not declared in the constraint"); } |