[Nice-commit] Nice/src/bossa/syntax ai.nice,1.5,1.6 alternative.nice,1.8,1.9 analyse.nice,1.127,1.12
Brought to you by:
bonniot
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30903/F:/nice/src/bossa/syntax Modified Files: ai.nice alternative.nice analyse.nice assign.nice block.nice call.nice constant.nice constraint.nice customConstructor.nice enum.nice exceptions.nice formalParameters.nice funexp.nice globalvar.nice inline.nice javaMethod.nice javaclass.nice locals.nice loop.nice methodContainer.nice methodImplementation.nice methodbody.nice monotype.nice newarray.nice niceMethod.nice niceclass.nice nicefield.nice overloadedsymbol.nice pattern.nice retypedMethod.nice rewrite.nice super.nice symbol.nice tools.nice try.nice tuple.nice typeConstructors.nice typeIdent.nice typecheck.nice typedef.nice Log Message: Conversion cleanup part 3. Index: typeIdent.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typeIdent.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** typeIdent.nice 14 Jan 2005 16:41:28 -0000 1.5 --- typeIdent.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 89,93 **** return res; ! if (res instanceof TypeConstructor) { let def = getTypeDefinition(res); --- 89,93 ---- return res; ! if (res instanceof mlsub.typing.TypeConstructor) { let def = getTypeDefinition(res); Index: constraint.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/constraint.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** constraint.nice 10 Jan 2005 23:58:04 -0000 1.2 --- constraint.nice 16 Jan 2005 00:28:21 -0000 1.3 *************** *** 23,27 **** public class Constraint extends Node { ! private List<TypeSymbol> binders; private List<AtomicConstraint> atomics; --- 23,27 ---- public class Constraint extends Node { ! private List<mlsub.typing.TypeSymbol> binders; private List<AtomicConstraint> atomics; *************** *** 60,72 **** while (i.hasNext()) { ! TypeSymbol s = i.next(); ! if (!(s instanceof TypeConstructor)) // Handle the ! constraint { ! MonotypeVar mv = cast(s); let j = c.atomics.iterator(); while (j.hasNext()) { ! AtomicConstraint atom = j.next(); if (atom.isSureConstraintFor(mv)) { --- 60,72 ---- while (i.hasNext()) { ! let s = i.next(); ! if (!(s instanceof mlsub.typing.TypeConstructor)) // Handle the ! constraint { ! mlsub.typing.MonotypeVar mv = cast(s); let j = c.atomics.iterator(); while (j.hasNext()) { ! let atom = j.next(); if (atom.isSureConstraintFor(mv)) { *************** *** 85,89 **** } ! TypeConstructor tc = s; boolean ok = false; let j = c.atomics.iterator(); --- 85,89 ---- } ! let tc = s; boolean ok = false; let j = c.atomics.iterator(); *************** *** 117,121 **** Add the binder to the front of the list of binders. */ ! void addFirstBinder(TypeSymbol s) { binders.add(0, s); --- 117,121 ---- Add the binder to the front of the list of binders. */ ! void addFirstBinder(mlsub.typing.TypeSymbol s) { binders.add(0, s); *************** *** 126,130 **** Add the binder if it is not already there. */ ! void addBinder(TypeSymbol s) { if (!binders.contains(s)) --- 126,130 ---- Add the binder if it is not already there. */ ! void addBinder(mlsub.typing.TypeSymbol s) { if (!binders.contains(s)) *************** *** 140,144 **** * @param b a collection of TypeSymbol */ ! void addBinders(TypeSymbol[?] bs) { if (bs==null) --- 140,144 ---- * @param b a collection of TypeSymbol */ ! void addBinders(mlsub.typing.TypeSymbol[?] bs) { if (bs==null) *************** *** 161,165 **** public boolean isTrivial() = binders.isEmpty() && atomics.isEmpty(); ! List<TypeSymbol> getBinders() = binders; List<AtomicConstraint> getAtoms() = atomics; } --- 161,165 ---- public boolean isTrivial() = binders.isEmpty() && atomics.isEmpty(); ! List<mlsub.typing.TypeSymbol> getBinders() = binders; List<AtomicConstraint> getAtoms() = atomics; } *************** *** 171,175 **** * @param atomics a collection of AtomicConstraints */ ! public Constraint createConstraint(?List<TypeSymbol> binders, ?List<AtomicConstraint> atomics) { if (binders == null && atomics == null) --- 171,175 ---- * @param atomics a collection of AtomicConstraints */ ! public Constraint createConstraint(?List<mlsub.typing.TypeSymbol> binders, ?List<AtomicConstraint> atomics) { if (binders == null && atomics == null) *************** *** 301,305 **** */ ! public class TypeConstructorLeqCst extends bossa.syntax.AtomicConstraint { mlsub.typing.TypeConstructor t1; --- 301,305 ---- */ ! public class TypeConstructorLeqCst extends AtomicConstraint { mlsub.typing.TypeConstructor t1; *************** *** 354,361 **** resolve(scope) { ! TypeConstructor stc = tc.resolveToTC(scope); ! ! TypeSymbol sitf = itf.resolveToTypeSymbol(scope); ! if (! (sitf instanceof Interface)) throw User.error(itf, itf+" should be an interface"); --- 354,360 ---- resolve(scope) { ! let stc = tc.resolveToTC(scope); ! let sitf = itf.resolveToTypeSymbol(scope); ! if (! (sitf instanceof mlsub.typing.Interface)) throw User.error(itf, itf+" should be an interface"); Index: block.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/block.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** block.nice 20 Dec 2004 13:56:16 -0000 1.3 --- block.nice 16 Jan 2005 00:28:21 -0000 1.4 *************** *** 91,98 **** } - /**************************************************************** - * Code generation - ****************************************************************/ - generateCode() { --- 91,94 ---- *************** *** 130,137 **** } - /**************************************************************** - * Printing - ****************************************************************/ - toString() { --- 126,129 ---- *************** *** 144,148 **** } ! public Statement createBlock(List<Statement> statements) { let res = new Block(statements: cast(null)); --- 136,140 ---- } ! public Block createBlock(List<Statement> statements) { let res = new Block(statements: cast(null)); Index: funexp.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/funexp.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** funexp.nice 13 Jan 2005 14:06:15 -0000 1.7 --- funexp.nice 16 Jan 2005 00:28:21 -0000 1.8 *************** *** 39,45 **** public class FunExp extends Expression implements Function { - final MonoSymbol[] formals; ! ?bossa.syntax.Constraint constraint; final Statement body; --- 39,44 ---- public class FunExp extends Expression implements Function { final MonoSymbol[] formals; ! ?Constraint constraint; final Statement body; *************** *** 50,54 **** private ?mlsub.typing.Polytype _inferredReturnType = null; - getExpectedType() { --- 49,52 ---- *************** *** 110,117 **** } - /**************************************************************** - * Code generation - ****************************************************************/ - compile() { --- 108,111 ---- Index: tuple.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tuple.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tuple.nice 15 Jan 2005 20:27:33 -0000 1.5 --- tuple.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 18,22 **** A tuple of types. */ ! public class TupleType extends bossa.syntax.Monotype { List<Monotype> types; --- 18,22 ---- A tuple of types. */ ! public class TupleType extends Monotype { List<Monotype> types; *************** *** 28,32 **** substitute(map) { ! bossa.syntax.Monotype res = new bossa.syntax.TupleType ( types : types.mapToArray(Monotype t => t.substitute(map)), location : location); res.nullness = this.nullness; --- 28,32 ---- substitute(map) { ! Monotype res = new TupleType ( types : types.mapToArray(Monotype t => t.substitute(map)), location : location); res.nullness = this.nullness; *************** *** 44,50 **** Creation of a tuple. */ ! public class TupleExp extends bossa.syntax.Expression { ! final bossa.syntax.Expression[] expressions; private mlsub.typing.Monotype[?] components = null; private mlsub.typing.Monotype[?] expectedComponents= null; --- 44,50 ---- Creation of a tuple. */ ! public class TupleExp extends Expression { ! final Expression[] expressions; private mlsub.typing.Monotype[?] components = null; private mlsub.typing.Monotype[?] expectedComponents= null; *************** *** 88,93 **** // Do the same for the elements of the tuple, since they might be // tuples themselves, literal arrays, ... ! bossa.syntax.Expression.adjustToExpectedType ! (expressions, expectedComponents); } } --- 88,92 ---- // Do the same for the elements of the tuple, since they might be // tuples themselves, literal arrays, ... ! Expression.adjustToExpectedType(expressions, expectedComponents); } } *************** *** 103,107 **** computeType() { ! let types = bossa.syntax.Expression.getType(expressions); // should create a new <tt>and</tt> method without the last dummy parameters let cst = mlsub.typing.Constraint.and(mlsub.typing.Polytype.getConstraint(types), --- 102,106 ---- computeType() { ! let types = Expression.getType(expressions); // should create a new <tt>and</tt> method without the last dummy parameters let cst = mlsub.typing.Constraint.and(mlsub.typing.Polytype.getConstraint(types), *************** *** 184,188 **** } ! public new TupleExp(List<bossa.syntax.Expression> expressions) { this(expressions: toArray(expressions)); --- 183,187 ---- } ! public new TupleExp(List<Expression> expressions) { this(expressions: toArray(expressions)); Index: javaclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaclass.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** javaclass.nice 13 Jan 2005 23:56:06 -0000 1.5 --- javaclass.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 85,90 **** * associated TypeConstructor in which case it is returned. */ ! ?TypeConstructor setTypeConstructorForJavaClass ! (bossa.modules.Compilation compilation, TypeConstructor tc, gnu.bytecode.Type type) = compilation.javaTypeConstructors.put(type, tc); --- 85,90 ---- * associated TypeConstructor in which case it is returned. */ ! ?mlsub.typing.TypeConstructor setTypeConstructorForJavaClass ! (bossa.modules.Compilation compilation, mlsub.typing.TypeConstructor tc, gnu.bytecode.Type type) = compilation.javaTypeConstructors.put(type, tc); *************** *** 105,109 **** } ! boolean excludedInterface(TypeConstructor itf) { ?gnu.bytecode.Type t = nice.tools.code.Types.get(itf); --- 105,109 ---- } ! boolean excludedInterface(mlsub.typing.TypeConstructor itf) { ?gnu.bytecode.Type t = nice.tools.code.Types.get(itf); *************** *** 114,118 **** } ! TypeConstructor createJavaType(bossa.modules.Compilation compilation, String className, gnu.bytecode.Type javaType) { --- 114,118 ---- } ! mlsub.typing.TypeConstructor createJavaType(bossa.modules.Compilation compilation, String className, gnu.bytecode.Type javaType) { *************** *** 123,129 **** // (thus used at link test with an error) // these late TCs should be avoided ! boolean instantiable = !Typing.isInRigidContext() && instantiable(javaType); ! TypeConstructor res = new TypeConstructor(className, null, instantiable, true); let old = compilation.javaTypeConstructors.put(javaType, res); --- 123,129 ---- // (thus used at link test with an error) // these late TCs should be avoided ! boolean instantiable = !mlsub.typing.Typing.isInRigidContext() && instantiable(javaType); ! let res = new mlsub.typing.TypeConstructor(className, null, instantiable, true); let old = compilation.javaTypeConstructors.put(javaType, res); *************** *** 133,137 **** nice.tools.code.Types.set(res, javaType); ! if(Typing.isInRigidContext()) // We should not add new classes at this point. // It doesn't matter, as this type is not used explicitely. --- 133,137 ---- nice.tools.code.Types.set(res, javaType); ! if(mlsub.typing.Typing.isInRigidContext()) // We should not add new classes at this point. // It doesn't matter, as this type is not used explicitely. *************** *** 143,147 **** } ! Typing.introduce(res); // Recursive search for java super-classes --- 143,147 ---- } ! mlsub.typing.Typing.introduce(res); // Recursive search for java super-classes *************** *** 159,166 **** { try { ! TypeConstructor superTC = nice.tools.code.Types.typeConstructor(superClass); ! Typing.initialLeq(res, superTC); } ! catch(TypingEx e) { Internal.warning("Invalid java super-class "+superClass+" for "+className); } --- 159,166 ---- { try { ! let superTC = nice.tools.code.Types.typeConstructor(superClass); ! mlsub.typing.Typing.initialLeq(res, superTC); } ! catch(mlsub.typing.TypingEx e) { Internal.warning("Invalid java super-class "+superClass+" for "+className); } *************** *** 187,194 **** try { ! TypeConstructor superTC = nice.tools.code.Types.typeConstructor(itf); ! Typing.initialLeq(res, superTC); } ! catch(TypingEx e) { Internal.warning(res+" cannot implement " + itf /* + ": " + e.toString()*/); } --- 187,194 ---- try { ! let superTC = nice.tools.code.Types.typeConstructor(itf); ! mlsub.typing.Typing.initialLeq(res, superTC); } ! catch(mlsub.typing.TypingEx e) { Internal.warning(res+" cannot implement " + itf /* + ": " + e.toString()*/); } *************** *** 212,220 **** } ! void setArity(TypeConstructor tc, int arity) { try { ! Variance variance = arity == 0 ? ! Variance.empty() : Variance.make(new int[arity]); mlsub.typing.lowlevel.Engine.setKind(tc, variance.getConstraint()); } --- 212,220 ---- } ! void setArity(mlsub.typing.TypeConstructor tc, int arity) { try { ! let variance = arity == 0 ? ! mlsub.typing.Variance.empty() : mlsub.typing.Variance.make(new int[arity]); mlsub.typing.lowlevel.Engine.setKind(tc, variance.getConstraint()); } *************** *** 234,245 **** } ! ?TypeConstructor lookupJavaClass(String className, ?Location loc) { ! ?gnu.bytecode.Type classType = nice.tools.code.TypeImport.lookup(className, loc); if (classType == null) return null; ! bossa.modules.Compilation compilation = notNull(Node.compilation); if (compilation.javaTypeConstructors.containsKey(classType)) --- 234,245 ---- } ! ?mlsub.typing.TypeConstructor lookupJavaClass(String className, ?Location loc) { ! let classType = nice.tools.code.TypeImport.lookup(className, loc); if (classType == null) return null; ! let compilation = notNull(Node.compilation); if (compilation.javaTypeConstructors.containsKey(classType)) Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** niceclass.nice 14 Jan 2005 22:47:11 -0000 1.21 --- niceclass.nice 16 Jan 2005 00:28:21 -0000 1.22 *************** *** 215,219 **** try { ! Typing.leq(value.getType(), declaredType); } catch (mlsub.typing.TypingEx ex) { --- 215,219 ---- try { ! mlsub.typing.Typing.leq(value.getType(), declaredType); } catch (mlsub.typing.TypingEx ex) { *************** *** 326,330 **** mlsub.typing.Typing.leave(); } ! catch(TypingEx ex) { User.error(this.definition, "Type error in field declarations"); } --- 326,330 ---- mlsub.typing.Typing.leave(); } ! catch(mlsub.typing.TypingEx ex) { User.error(this.definition, "Type error in field declarations"); } *************** *** 393,397 **** */ private List<(?MethodDeclaration, List<Parameter>)> ! getNativeConstructorParameters(TypeConstructor tc) { let constructors = getConstructors(tc); --- 393,397 ---- */ private List<(?MethodDeclaration, List<Parameter>)> ! getNativeConstructorParameters(mlsub.typing.TypeConstructor tc) { let constructors = getConstructors(tc); *************** *** 433,437 **** { TypeScope scope = Node.getGlobalTypeScope(); ! ?Map<TypeSymbol,TypeSymbol> map = null; if (typeParameters != null) --- 433,437 ---- { TypeScope scope = Node.getGlobalTypeScope(); ! ?Map<mlsub.typing.TypeSymbol,mlsub.typing.TypeSymbol> map = null; if (typeParameters != null) *************** *** 444,449 **** for (int i = 0; i < ourTypeParameters.length; i++) try { ! TypeSymbol ourSym = asTypeSymbol(ourTypeParameters[i]); ! TypeSymbol sym = asTypeSymbol(typeParameters[i]); scope.addMapping(ourSym.toString(), sym); notNull(map).put(ourSym, sym); --- 444,449 ---- for (int i = 0; i < ourTypeParameters.length; i++) try { ! let ourSym = asTypeSymbol(ourTypeParameters[i]); ! let sym = asTypeSymbol(typeParameters[i]); scope.addMapping(ourSym.toString(), sym); notNull(map).put(ourSym, sym); *************** *** 751,757 **** NiceClass createNiceClass(TypeDefinition cdef) = new NiceClass(definition: cdef); ! private TypeSymbol asTypeSymbol(mlsub.typing.Monotype type) { ! if (type instanceof TypeSymbol) return type; --- 751,757 ---- NiceClass createNiceClass(TypeDefinition cdef) = new NiceClass(definition: cdef); ! private mlsub.typing.TypeSymbol asTypeSymbol(mlsub.typing.Monotype type) { ! if (type instanceof mlsub.typing.TypeSymbol) return type; *************** *** 760,764 **** } ! private gnu.expr.Expression typeExpression(TypeConstructor tc) { let c = getTypeDefinition(tc); --- 760,764 ---- } ! private gnu.expr.Expression typeExpression(mlsub.typing.TypeConstructor tc) { let c = getTypeDefinition(tc); *************** *** 772,776 **** } ! ?NiceClass getNiceClass(TypeConstructor tc) { let res = getTypeDefinition(tc); --- 772,776 ---- } ! ?NiceClass getNiceClass(mlsub.typing.TypeConstructor tc) { let res = getTypeDefinition(tc); Index: javaMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaMethod.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** javaMethod.nice 14 Jan 2005 22:47:11 -0000 1.7 --- javaMethod.nice 16 Jan 2005 00:28:21 -0000 1.8 *************** *** 208,212 **** * to make them available to the nice code. */ ! void fetchMethods(TypeConstructor tc, gnu.bytecode.ClassType classType) { try { --- 208,212 ---- * to make them available to the nice code. */ ! void fetchMethods(mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType) { try { *************** *** 238,242 **** } ! void fetchMethod(gnu.bytecode.Method m, TypeConstructor tc, gnu.bytecode.ClassType classType) { if (m.isConstructor()) --- 238,242 ---- } ! void fetchMethod(gnu.bytecode.Method m, mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType) { if (m.isConstructor()) Index: rewrite.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/rewrite.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rewrite.nice 14 Jan 2005 22:47:11 -0000 1.8 --- rewrite.nice 16 Jan 2005 00:28:21 -0000 1.9 *************** *** 11,14 **** --- 11,16 ---- /**************************************************************************/ + package bossa.syntax; + /* Rewriting on the abstract syntax tree. *************** *** 30,35 **** */ - package bossa.syntax; - Statement rewrite(Statement); rewrite(Statement s) = s; --- 32,35 ---- *************** *** 69,73 **** ifExp(ExpressionStmt s) { ! if (s.exp instanceof bossa.syntax.IfExp) return cast(s.exp); else --- 69,73 ---- ifExp(ExpressionStmt s) { ! if (s.exp instanceof IfExp) return cast(s.exp); else Index: retypedMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/retypedMethod.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** retypedMethod.nice 14 Jan 2005 16:41:27 -0000 1.5 --- retypedMethod.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 270,274 **** void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod, ! TypeConstructor classe) { ?MethodDeclaration auto = retyped.put(reflectMethod, m); --- 270,274 ---- void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod, ! mlsub.typing.TypeConstructor classe) { ?MethodDeclaration auto = retyped.put(reflectMethod, m); Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** niceMethod.nice 14 Jan 2005 16:41:27 -0000 1.17 --- niceMethod.nice 16 Jan 2005 00:28:21 -0000 1.18 *************** *** 279,284 **** if (hasAlike || tc == null) { ! TypeConstructor alikeTC = ! new TypeConstructor("Alike", c.variance, false, false); // Add in front. Important for rebinding in method alternatives --- 279,283 ---- if (hasAlike || tc == null) { ! let alikeTC = new mlsub.typing.TypeConstructor("Alike", c.variance, false, false); // Add in front. Important for rebinding in method alternatives *************** *** 299,303 **** if (hasAlike) { ! Map<String, bossa.syntax.Monotype> map = new HashMap(); map.put(getAlikeID(), createMonotypeConstructor(alikeTC, --- 298,302 ---- if (hasAlike) { ! Map<String, Monotype> map = new HashMap(); map.put(getAlikeID(), createMonotypeConstructor(alikeTC, Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pattern.nice 14 Jan 2005 22:47:11 -0000 1.17 --- pattern.nice 16 Jan 2005 00:28:21 -0000 1.18 *************** *** 44,48 **** if (typeConstructor != null) { ! TypeSymbol sym = notNull(typeConstructor).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) --- 44,48 ---- if (typeConstructor != null) { ! let sym = notNull(typeConstructor).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) *************** *** 62,66 **** if (additional != null) { ! TypeSymbol sym = notNull(additional).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) --- 62,66 ---- if (additional != null) { ! let sym = notNull(additional).resolveToTypeSymbol(scope); if (sym instanceof mlsub.typing.TypeConstructor) *************** *** 351,355 **** // don't allow integer primitive types in @type and #type patterns ! if (!equal && Typing.testRigidLeq(tc, nice.tools.typing.PrimitiveType.longTC)) User.error(this.location, "A pattern cannot have a primitive type that is different from the declaration."); --- 351,355 ---- // don't allow integer primitive types in @type and #type patterns ! if (!equal && mlsub.typing.Typing.testRigidLeq(tc, nice.tools.typing.PrimitiveType.longTC)) User.error(this.location, "A pattern cannot have a primitive type that is different from the declaration."); *************** *** 395,399 **** { if (domaintc != null) ! if ( Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.charTC)) return; --- 395,399 ---- { if (domaintc != null) ! if (mlsub.typing.Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.charTC)) return; *************** *** 410,419 **** if (domaintc != null) { ! if (Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.intTC)) { tc = nice.tools.typing.PrimitiveType.intTC; return; } ! else if (Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.longTC)) { tc = nice.tools.typing.PrimitiveType.longTC; --- 410,419 ---- if (domaintc != null) { ! if (mlsub.typing.Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.intTC)) { tc = nice.tools.typing.PrimitiveType.intTC; return; } ! else if (mlsub.typing.Typing.testRigidLeq(domaintc, nice.tools.typing.PrimitiveType.longTC)) { tc = nice.tools.typing.PrimitiveType.longTC; *************** *** 556,560 **** return this.exactlyAt || ! that.exactlyAt; ! return Typing.testRigidLeq(this.tc, that.tc); } leq(Pattern this, Pattern that) --- 556,560 ---- return this.exactlyAt || ! that.exactlyAt; ! return mlsub.typing.Typing.testRigidLeq(this.tc, that.tc); } leq(Pattern this, Pattern that) *************** *** 563,567 **** return true; ! return Typing.testRigidLeq(this.tc, that.tc); } --- 563,567 ---- return true; ! return mlsub.typing.Typing.testRigidLeq(this.tc, that.tc); } *************** *** 604,609 **** if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! Typing.testRigidLeq(this.tc, that.tc)) && ! (! Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint --- 604,609 ---- if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! mlsub.typing.Typing.testRigidLeq(this.tc, that.tc)) && ! (! mlsub.typing.Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint *************** *** 614,619 **** { if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! Typing.testRigidLeq(this.tc, that.tc)) && ! (! Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint --- 614,619 ---- { if (isClassTC(notNull(this.tc)) && isClassTC(notNull(that.tc))) ! return (! mlsub.typing.Typing.testRigidLeq(this.tc, that.tc)) && ! (! mlsub.typing.Typing.testRigidLeq(that.tc, this.tc)); //TODO: check disjoints for all tc's with a <T | T <: TC_PA, T <: TC_PB> constraint *************** *** 716,720 **** { ConstantExp val = cast(symbol.getValue()); ! if (Typing.testRigidLeq(val.tc, nice.tools.typing.PrimitiveType.longTC)) return createPattern(pattern.kind.prefix, pattern.name, val, null, pattern.location); } --- 716,720 ---- { ConstantExp val = cast(symbol.getValue()); ! if (mlsub.typing.Typing.testRigidLeq(val.tc, nice.tools.typing.PrimitiveType.longTC)) return createPattern(pattern.kind.prefix, pattern.name, val, null, pattern.location); } *************** *** 860,864 **** return createPattern(createBooleanConstant(name.equals("true"), loc)); ! ?TypeSymbol sym = Node.getGlobalTypeScope().lookup(name); if (sym == null) --- 860,864 ---- return createPattern(createBooleanConstant(name.equals("true"), loc)); ! let sym = Node.getGlobalTypeScope().lookup(name); if (sym == null) Index: formalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/formalParameters.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** formalParameters.nice 13 Jan 2005 16:47:34 -0000 1.6 --- formalParameters.nice 16 Jan 2005 00:28:21 -0000 1.7 *************** *** 70,74 **** } ! void substitute(Map<java.lang.String, bossa.syntax.Monotype> map) { for (int i = size; --i>=0; ) --- 70,74 ---- } ! void substitute(Map<java.lang.String, Monotype> map) { for (int i = size; --i>=0; ) Index: super.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/super.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** super.nice 14 Jan 2005 22:47:11 -0000 1.11 --- super.nice 16 Jan 2005 00:28:21 -0000 1.12 *************** *** 131,139 **** for (int i = 0; i < p.length; i++) if (p[i].tc != null) ! newAtoms.add(new TypeConstructorLeqMonotypeCst(p[i].tc, m[i])); } else { ! ?TypeConstructor superTC = null; try { superTC = nice.tools.code.Types.typeConstructor(notNull(superMethod).getDeclaringClass()); --- 131,139 ---- for (int i = 0; i < p.length; i++) if (p[i].tc != null) ! newAtoms.add(new mlsub.typing.TypeConstructorLeqMonotypeCst(p[i].tc, m[i])); } else { ! ?mlsub.typing.TypeConstructor superTC = null; try { superTC = nice.tools.code.Types.typeConstructor(notNull(superMethod).getDeclaringClass()); *************** *** 142,146 **** if (superTC != null) ! newAtoms.add(new TypeConstructorLeqMonotypeCst(superTC, m[0])); else // Our safe bet is to assert that the argument is Object. --- 142,146 ---- if (superTC != null) ! newAtoms.add(new mlsub.typing.TypeConstructorLeqMonotypeCst(superTC, m[0])); else // Our safe bet is to assert that the argument is Object. Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** customConstructor.nice 14 Jan 2005 22:47:11 -0000 1.19 --- customConstructor.nice 16 Jan 2005 00:28:21 -0000 1.20 *************** *** 82,86 **** } ! private Map<String, Monotype> typeParamMap(TypeSymbol[] source, mlsub.typing.Monotype[] destination) { Map<String, Monotype> res = new HashMap(source.length); --- 82,86 ---- } ! private Map<String, Monotype> typeParamMap(mlsub.typing.TypeSymbol[] source, mlsub.typing.Monotype[] destination) { Map<String, Monotype> res = new HashMap(source.length); *************** *** 170,174 **** return classe; ! List<TypeSymbol> syms = cst.getBinders(); Monotype[] params = cast(new Monotype[syms.size()]); --- 170,174 ---- return classe; ! List<mlsub.typing.TypeSymbol> syms = cst.getBinders(); Monotype[] params = cast(new Monotype[syms.size()]); Index: globalvar.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** globalvar.nice 14 Jan 2005 22:47:11 -0000 1.5 --- globalvar.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 35,41 **** value = value.resolveOverloading(left.getType()); typecheck(value); ! Typing.leq(value.getType(),left.getType()); } ! catch(TypingEx e){ User.error(this,"Typing error : "+left+" cannot be assigned value "+value+ " of type "+value.getType()+" : \n"+ --- 35,41 ---- value = value.resolveOverloading(left.getType()); typecheck(value); ! mlsub.typing.Typing.leq(value.getType(),left.getType()); } ! catch(mlsub.typing.TypingEx e){ User.error(this,"Typing error : "+left+" cannot be assigned value "+value+ " of type "+value.getType()+" : \n"+ Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** typecheck.nice 15 Jan 2005 20:27:33 -0000 1.123 --- typecheck.nice 16 Jan 2005 00:28:21 -0000 1.124 *************** *** 17,22 **** package bossa.syntax; - import mlsub.typing.*; - // Interface --- 17,20 ---- *************** *** 55,59 **** checkAssignment(to.getType(), e.value); } ! catch(TypingEx t){ if (variable != null) { let originalType = getOriginalType(variable); --- 53,57 ---- checkAssignment(to.getType(), e.value); } ! catch(mlsub.typing.TypingEx t){ if (variable != null) { let originalType = getOriginalType(variable); *************** *** 70,74 **** return; } ! catch (TypingEx newError) { t = newError; } } --- 68,72 ---- return; } ! catch (mlsub.typing.TypingEx newError) { t = newError; } } *************** *** 94,98 **** try { checkAssignment(originalType, e.value); ! } catch (TypingEx t) { throw assignmentError(e, to.toString(), to.getType().toString(), e.value); --- 92,96 ---- try { checkAssignment(originalType, e.value); ! } catch (mlsub.typing.TypingEx t) { throw assignmentError(e, to.toString(), to.getType().toString(), e.value); *************** *** 233,237 **** if (t.getConstraint() != mlsub.typing.Constraint.True) try{ ! Typing.enter(); try{ mlsub.typing.Constraint.enter(t.getConstraint()); --- 231,235 ---- if (t.getConstraint() != mlsub.typing.Constraint.True) try{ ! mlsub.typing.Typing.enter(); try{ mlsub.typing.Constraint.enter(t.getConstraint()); *************** *** 239,246 **** } finally{ ! Typing.leave(); } } ! catch(TypingEx te){ } } --- 237,244 ---- } finally{ ! mlsub.typing.Typing.leave(); } } ! catch(mlsub.typing.TypingEx te){ } } *************** *** 621,625 **** checkAssignment(nice.tools.typing.PrimitiveType.longType, e.variable); } ! catch(TypingEx t){ if (notNullError(t, e, String.valueOf(e.variable))) throw new bossa.util.UserError --- 619,623 ---- checkAssignment(nice.tools.typing.PrimitiveType.longType, e.variable); } ! catch(mlsub.typing.TypingEx t){ if (notNullError(t, e, String.valueOf(e.variable))) throw new bossa.util.UserError *************** *** 646,650 **** checkAssignment(nice.tools.typing.PrimitiveType.intType, dim); } ! catch(TypingEx ex){ if (notNullError(ex, dim, dim.toString())) --- 644,648 ---- checkAssignment(nice.tools.typing.PrimitiveType.intType, dim); } ! catch(mlsub.typing.TypingEx ex){ if (notNullError(ex, dim, dim.toString())) *************** *** 710,714 **** checkAssignment(type, value); } ! catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName.toString(), --- 708,712 ---- checkAssignment(type, value); } ! catch(mlsub.typing.TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName.toString(), *************** *** 786,790 **** checkAssignment(type, value); } ! catch(TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName().toString(), --- 784,788 ---- checkAssignment(type, value); } ! catch(mlsub.typing.TypingEx t){ reportNullAssignmentError(decl, t, value: value, target.getName().toString(), *************** *** 817,823 **** typecheck(decl.value); try{ ! Typing.leq(decl.inferredReturnType(), decl.declaredReturnType()); } ! catch(TypingEx t){ if (notNullError(t, decl, "returned value")) wrongReturnType(decl, --- 815,821 ---- typecheck(decl.value); try{ ! mlsub.typing.Typing.leq(decl.inferredReturnType(), decl.declaredReturnType()); } ! catch(mlsub.typing.TypingEx t){ if (notNullError(t, decl, "returned value")) wrongReturnType(decl, *************** *** 956,963 **** checkNotNull(type); } ! catch(TypingEx ex) { bossa.util.User.error(s.object, "Synchonization must be done on a non-null object.\n" + s.object + " might be null."); } - typecheck(s.body); --- 954,960 ---- checkNotNull(type); } ! catch(mlsub.typing.TypingEx ex) { bossa.util.User.error(s.object, "Synchonization must be done on a non-null object.\n" + s.object + " might be null."); } typecheck(s.body); *************** *** 982,986 **** { typecheck(right); ! Typing.leq(right.getType(), left); } } --- 979,983 ---- { typecheck(right); ! mlsub.typing.Typing.leq(right.getType(), left); } } *************** *** 989,997 **** { typecheck(right); ! Typing.leq(right.getType(), left); } ! boolean isNullError(TypingEx ex) = false; ! isNullError(MonotypeLeqEx ex) { /* --- 986,995 ---- { typecheck(right); ! mlsub.typing.Typing.leq(right.getType(), left); } ! boolean isNullError(mlsub.typing.TypingEx ex) = false; ! ! isNullError(mlsub.typing.MonotypeLeqEx ex) { /* *************** *** 1000,1005 **** to keep track of the lowlevel exception. */ ! ?TypeConstructor tc1 = notNull(ex.getM1()).head(); ! ?TypeConstructor tc2 = notNull(ex.getM2()).head(); if (tc1 == tc2) return false; --- 998,1003 ---- to keep track of the lowlevel exception. */ ! let tc1 = notNull(ex.getM1()).head(); ! let tc2 = notNull(ex.getM2()).head(); if (tc1 == tc2) return false; *************** *** 1017,1021 **** Returns true the error is not related to null types. */ ! boolean notNullError(TypingEx ex, bossa.util.Located resp, ?String value) { if (isNullError(ex)) throw new bossa.util.UserError(resp, "" + value + " might be null"); --- 1015,1019 ---- Returns true the error is not related to null types. */ ! boolean notNullError(mlsub.typing.TypingEx ex, bossa.util.Located resp, ?String value) { if (isNullError(ex)) throw new bossa.util.UserError(resp, "" + value + " might be null"); *************** *** 1028,1032 **** checkAssignment(nice.tools.typing.PrimitiveType.boolType, condition); } ! catch(TypingEx t){ throw new bossa.util.UserError(condition, "The condition must be a boolean.\n" + --- 1026,1030 ---- checkAssignment(nice.tools.typing.PrimitiveType.boolType, condition); } ! catch(mlsub.typing.TypingEx t){ throw new bossa.util.UserError(condition, "The condition must be a boolean.\n" + *************** *** 1054,1067 **** { if (type.isMonomorphic()) ! Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); else try { ! Typing.enter(); notNull(type.getConstraint()).enter(); ! Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); ! Typing.implies(); } finally { ! Typing.leave(); } } --- 1052,1065 ---- { if (type.isMonomorphic()) ! mlsub.typing.Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); else try { ! mlsub.typing.Typing.enter(); notNull(type.getConstraint()).enter(); ! mlsub.typing.Typing.leq(type.getMonotype(), nice.tools.typing.PrimitiveType.sureTC); ! mlsub.typing.Typing.implies(); } finally { ! mlsub.typing.Typing.leave(); } } Index: try.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/try.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** try.nice 12 Jan 2005 18:50:38 -0000 1.5 --- try.nice 16 Jan 2005 00:28:21 -0000 1.6 *************** *** 15,23 **** import bossa.util.*; - /** A try/catch/finally statement */ - public class TryStmt extends Statement { --- 15,21 ---- Index: alternative.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** alternative.nice 14 Jan 2005 22:47:11 -0000 1.8 --- alternative.nice 16 Jan 2005 00:28:21 -0000 1.9 *************** *** 38,42 **** * Tests the matching of tags against a method alternative. */ ! public boolean matches(?TypeConstructor[] tags) { for(int i = 0; i < patterns.length; i++) --- 38,42 ---- * Tests the matching of tags against a method alternative. */ ! public boolean matches(?mlsub.typing.TypeConstructor[] tags) { for(int i = 0; i < patterns.length; i++) *************** *** 47,51 **** } ! public boolean matchesTypePart(?TypeConstructor[] tags, boolean[] isValue) { for(int i = 0; i < patterns.length; i++) --- 47,51 ---- } ! public boolean matchesTypePart(?mlsub.typing.TypeConstructor[] tags, boolean[] isValue) { for(int i = 0; i < patterns.length; i++) Index: call.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/call.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** call.nice 15 Jan 2005 20:27:33 -0000 1.11 --- call.nice 16 Jan 2005 00:28:21 -0000 1.12 *************** *** 74,78 **** { this.setComputedType(notNull(getTypeAndReportErrors(this.location(), function, arguments.inOrder())), null); ! arguments.computedExpressions = cast(arguments.inOrder()); } --- 74,78 ---- { this.setComputedType(notNull(getTypeAndReportErrors(this.location(), function, arguments.inOrder())), null); ! arguments.computedExpressions = arguments.inOrder(); } *************** *** 111,115 **** { this.resolveOverloading(); ! let ?FieldAccess fa = function.getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } --- 111,115 ---- { this.resolveOverloading(); ! let fa = function.getFieldAccessMethod(); return fa != null && ! fa.isFinal(); } *************** *** 155,160 **** gnu.expr.Expression res; ! if (function.isFieldAccess()) ! res = notNull(function.getFieldAccessMethod()).compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); --- 155,161 ---- gnu.expr.Expression res; ! let fa = function.getFieldAccessMethod(); ! if (fa != null) ! res = fa.compileAccess(this.compileParams()); else res = new gnu.expr.ApplyExp(function.generateCodeInCallPosition(), this.compileParams()); *************** *** 172,176 **** private gnu.expr.Expression[] compileParams() { ! bossa.syntax.Expression[] compexps = cast(arguments.computedExpressions); gnu.expr.Expression[] params = Expression_compile(compexps); --- 173,177 ---- private gnu.expr.Expression[] compileParams() { ! Expression[] compexps = cast(arguments.computedExpressions); gnu.expr.Expression[] params = Expression_compile(compexps); *************** *** 195,202 **** compileAssign(gnu.expr.Expression value) { ! if (!function.isFieldAccess()) ! Internal.error(this, "Assignment to a call that is not a field access"); ! ! FieldAccess access = notNull(function.getFieldAccessMethod()); if (access.isFinal()) --- 196,202 ---- compileAssign(gnu.expr.Expression value) { ! let access = function.getFieldAccessMethod(); ! if (access == null) ! throw Internal.error(this, "Assignment to a call that is not a field access"); if (access.isFinal()) *************** *** 209,214 **** return access.compileAssign(arguments.getExp(0).generateCode(), value); ! Internal.error(this, "A field access should have 0 or 1 parameter"); ! return cast(null); } --- 209,213 ---- return access.compileAssign(arguments.getExp(0).generateCode(), value); ! throw Internal.error(this, "A field access should have 0 or 1 parameter"); } *************** *** 290,294 **** return getType(function.getType(), paramTypes, false); } ! catch(BadSizeEx e){ User.error(loc, function.toString(Printable.detailed) + " expects " + e.expected + " parameters, " + --- 289,293 ---- return getType(function.getType(), paramTypes, false); } ! catch(mlsub.typing.BadSizeEx e){ User.error(loc, function.toString(Printable.detailed) + " expects " + e.expected + " parameters, " + *************** *** 298,303 **** User.error(loc, e.getMessage()); } ! catch(TypingEx e){ ! if (Typing.dbg) bossa.util.Debug.println(e.getMessage()); --- 297,302 ---- User.error(loc, e.getMessage()); } ! catch(mlsub.typing.TypingEx e){ ! if (mlsub.typing.Typing.dbg) bossa.util.Debug.println(e.getMessage()); *************** *** 343,347 **** mlsub.typing.Typing.leq(m.head(), nice.tools.typing.PrimitiveType.sureTC); } ! catch(TypingEx ex) { throw new ReportErrorEx("This function may be null"); } --- 342,346 ---- mlsub.typing.Typing.leq(m.head(), nice.tools.typing.PrimitiveType.sureTC); } ! catch(mlsub.typing.TypingEx ex) { throw new ReportErrorEx("This function may be null"); } Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** analyse.nice 14 Jan 2005 22:47:11 -0000 1.127 --- analyse.nice 16 Jan 2005 00:28:21 -0000 1.128 *************** *** 18,22 **** import nice.tools.ast; - import mlsub.typing.*; // Interface --- 18,21 ---- *************** *** 30,34 **** buildInfo(varScope, typeScope) { ! let SymbolTable<TypeSymbol> t = new SymbolTable(); return new Info(vars: new SymbolTable(), typeVars: t, outerVarScope: varScope, outerTypeScope: typeScope, --- 29,33 ---- buildInfo(varScope, typeScope) { ! let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable(); return new Info(vars: new SymbolTable(), typeVars: t, outerVarScope: varScope, outerTypeScope: typeScope, *************** *** 73,77 **** { SymbolTable<VarSymbol> vars; ! SymbolTable<TypeSymbol> typeVars; VarScope outerVarScope; --- 72,76 ---- { SymbolTable<VarSymbol> vars; ! SymbolTable<mlsub.typing.TypeSymbol> typeVars; VarScope outerVarScope; *************** *** 180,186 **** this.outerVarScope.lookup(name); ! ?TypeSymbol lookupType(LocatedString name) { ! ?TypeSymbol res = this.typeVars[name.toString()]; if (res != null) return res; --- 179,185 ---- this.outerVarScope.lookup(name); ! ?mlsub.typing.TypeSymbol lookupType(LocatedString name) { ! let res = this.typeVars[name.toString()]; if (res != null) return res; *************** *** 223,228 **** symbols.foreach(MonoSymbol s => this.addVar(s)); ! void addTypeVars(TypeSymbol[] symbols) = ! symbols.foreach(TypeSymbol s => this.typeVars[s.toString()] = s); void checkNotDefined(VarSymbol symbol) --- 222,227 ---- symbols.foreach(MonoSymbol s => this.addVar(s)); ! void addTypeVars(mlsub.typing.TypeSymbol[] symbols) = ! symbols.foreach(mlsub.typing.TypeSymbol s => this.typeVars[s.toString()] = s); void checkNotDefined(VarSymbol symbol) *************** *** 615,627 **** return c; ! ?TypeSymbol s = info.lookupType(notNull(c.className)); if (s == null) ! bossa.util.Internal.error ! ("Base type " + c.className + " was not found in the standard library"); ! ?TypeConstructor tc = TypeConstructor.fromTypeSymbol(notNull(s)); if (tc == null) ! bossa.util.Internal.error("Base type " + c.className + " is not valid"); c.type = new mlsub.typing.Polytype --- 614,625 ---- return c; ! let s = info.lookupType(notNull(c.className)); if (s == null) ! throw Internal.error("Base type " + c.className + " was not found in the standard library"); ! let tc = mlsub.typing.TypeConstructor.fromTypeSymbol(s); if (tc == null) ! throw Internal.error("Base type " + c.className + " is not valid"); c.type = new mlsub.typing.Polytype *************** *** 649,653 **** } ! ?TypeConstructor tc = Node.getGlobalTypeScope().globalLookup(name, loc); if (tc == null) --- 647,651 ---- } ! ?mlsub.typing.TypeConstructor tc = Node.getGlobalTypeScope().globalLookup(name, loc); if (tc == null) *************** *** 656,660 **** return nice.tools.typing.PrimitiveType.objectPolytype(); ! if (info.typeVars[name] instanceof MonotypeVar) throw new bossa.util.UserError(loc, "A type variable cannot be used here"); else --- 654,658 ---- return nice.tools.typing.PrimitiveType.objectPolytype(); ! if (info.typeVars[name] instanceof mlsub.typing.MonotypeVar) throw new bossa.util.UserError(loc, "A type variable cannot be used here"); else Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** locals.nice 14 Jan 2005 22:47:11 -0000 1.9 --- locals.nice 16 Jan 2005 00:28:21 -0000 1.10 *************** *** 52,57 **** if (value == null) return this.getSymbol().toString(); ! else ! return this.getSymbol().toString() + '=' + value; } } --- 52,57 ---- if (value == null) return this.getSymbol().toString(); ! ! return this.getSymbol().toString() + '=' + value; } } *************** *** 209,216 **** ! public Statement createLocalVariable(LocatedString name, ?Monotype type, boolean constant, ?Expression value) { if (type == null && value == null) ! User.error(name,"A local variable requires a type or a default value"); if (constant && type == null) --- 209,216 ---- ! public LocalValue createLocalVariable(LocatedString name, ?Monotype type, boolean constant, ?Expression value) { if (type == null && value == null) ! throw User.error(name,"A local variable requires a type or a default value"); if (constant && type == null) *************** *** 220,229 **** } - public void addNextLocal(Statement localValue, LocatedString name, ?Expression value) - { - LocalValue lv = cast(localValue); - lv.addNext(name, value); - } - public class ExpLocalVariable extends Expression { --- 220,223 ---- Index: methodbody.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodbody.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** methodbody.nice 14 Jan 2005 16:41:27 -0000 1.11 --- methodbody.nice 16 Jan 2005 00:28:21 -0000 1.12 *************** *** 72,76 **** ?mlsub.typing.TypeConstructor[] additionalTags = formals.mapToArray(Pattern p => p.tc2); ! boolean hasAdditionalTags = additionalTags.any(?TypeConstructor tc => tc != null); // Try to remember what caused the error when no symbol could be found. --- 72,76 ---- ?mlsub.typing.TypeConstructor[] additionalTags = formals.mapToArray(Pattern p => p.tc2); ! boolean hasAdditionalTags = additionalTags.any(?mlsub.typing.TypeConstructor tc => tc != null); // Try to remember what caused the error when no symbol could be found. *************** *** 115,119 **** formals[p].inDomain(domain[p]); } ! catch (TypingEx e) { errorList.add(m, new LocatedString("Pattern " + formals[p] + " is incompatible with " + domain[p], --- 115,119 ---- formals[p].inDomain(domain[p]); } ! catch (mlsub.typing.TypingEx e) { errorList.add(m, new LocatedString("Pattern " + formals[p] + " is incompatible with " + domain[p], *************** *** 124,132 **** } finally{ ! if (Typing.leave() != level) Internal.error("Enter/Leave error"); } } ! catch(TypingEx e){ if (bossa.util.Debug.overloading) bossa.util.Debug.println("Not the right choice :"+e); i.remove(); --- 124,132 ---- } finally{ ! if (mlsub.typing.Typing.leave() != level) Internal.error("Enter/Leave error"); } } ! catch(mlsub.typing.TypingEx e){ if (bossa.util.Debug.overloading) bossa.util.Debug.println("Not the right choice :"+e); i.remove(); *************** *** 168,176 **** this.domainMonotypeLeq(dom1[i], dom2[i]); } ! catch (TypingEx e) { additionalsEqual = false; } } ! catch(TypingEx e) { remove = false; break; --- 168,176 ---- this.domainMonotypeLeq(dom1[i], dom2[i]); } ! catch (mlsub.typing.TypingEx e) { additionalsEqual = false; } } ! catch(mlsub.typing.TypingEx e) { remove = false; break; *************** *** 323,327 **** try { mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); ! Typing.implies(); mlsub.typing.Monotype[] domain = notNull(notNull(declaration).getType()).domain(); --- 323,327 ---- try { mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); ! mlsub.typing.Typing.implies(); mlsub.typing.Monotype[] domain = notNull(notNull(declaration).getType()).domain(); *************** *** 332,342 **** formals[n] = formals[n].setDomainEq(tc != null && nice.tools.typing.Types.isSure(domain[n]) && ! Typing.testLeq(tc, formals[n].tc)); } } finally { if (entered) ! Typing.leave(); } ! } catch(TypingEx ex) { Internal.warning(ex.toString()); } --- 332,342 ---- formals[n] = formals[n].setDomainEq(tc != null && nice.tools.typing.Types.isSure(domain[n]) && ! mlsub.typing.Typing.testLeq(tc, formals[n].tc)); } } finally { if (entered) ! mlsub.typing.Typing.leave(); } ! } catch(mlsub.typing.TypingEx ex) { Internal.warning(ex.toString()); } *************** *** 348,354 **** int level; if (bossa.util.Debug.typing) ! level = Typing.enter("METHOD BODY " + this + "\n\n"); else ! level = Typing.enter(); try { --- 348,354 ---- int level; if (bossa.util.Debug.typing) ! level = mlsub.typing.Typing.enter("METHOD BODY " + this + "\n\n"); else ! level = mlsub.typing.Typing.enter(); try { *************** *** 357,361 **** mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); } ! catch(TypingEx e){ throw User.error(name, "the constraint will never be satisfied", --- 357,361 ---- mlsub.typing.Constraint.enter(notNull(notNull(declaration).getType()).getConstraint()); } ! catch(mlsub.typing.TypingEx e){ throw User.error(name, "the constraint will never be satisfied", *************** *** 388,392 **** try { monotypes.inPattern(formals); ! } catch(TypingEx e){ throw User.error(name,"The patterns are not correct", e); } --- 388,392 ---- try { monotypes.inPattern(formals); ! } catch(mlsub.typing.TypingEx e){ throw User.error(name,"The patterns are not correct", e); } *************** *** 396,400 **** try { mlsub.typing.Typing.leq(monotypes[i], domain[i]); ! } catch(TypingEx e) { /* This type error originates from an inadequation between --- 396,400 ---- try { mlsub.typing.Typing.leq(monotypes[i], domain[i]); ! } catch(mlsub.typing.TypingEx e) { /* This type error originates from an inadequation between *************** *** 410,416 **** nice.tools.code.Types.setBytecodeType(monotypes); ! Typing.implies(); } ! catch(TypingEx e) { throw User.error(name, "Type error in method body \""+name+"\":\n"+e); } --- 410,416 ---- nice.tools.code.Types.setBytecodeType(monotypes); ! mlsub.typing.Typing.implies(); } ! catch(mlsub.typing.TypingEx e) { throw User.error(name, "Type error in method body \""+name+"\":\n"+e); } *************** *** 429,435 **** Node.thisExp = null; try { ! if (Typing.leave() != level) Internal.error("Unmatching enter/leave"); ! } catch(TypingEx e){ if (! errorFound) User.error(this, "Type error in method "+name, ": "+e); --- 429,435 ---- Node.thisExp = null; try { ! if (mlsub.typing.Typing.leave() != level) Internal.error("Unmatching enter/leave"); ! } catch(mlsub.typing.TypingEx e){ if (! errorFound) User.error(this, "Type error in method "+name, ": "+e); Index: assign.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/assign.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** assign.nice 13 Jan 2005 16:47:34 -0000 1.6 --- assign.nice 16 Jan 2005 00:28:21 -0000 1.7 *************** *** 44,50 **** args.add(new Argument(value: value)); ! return createCallExp( ! createIdentExp(new LocatedString("set", to.function.location())), ! new Arguments(arguments: args.toArray())); } --- 44,50 ---- args.add(new Argument(value: value)); ! return new CallExp( ! function: createIdentExp(new LocatedString("set", to.function.location())), ! arguments: new Arguments(arguments: args.toArray())); } Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** enum.nice 14 Jan 2005 22:47:11 -0000 1.15 --- enum.nice 16 Jan 2005 00:28:21 -0000 1.16 *************** *** 149,153 **** typecheck(value); ... [truncated message content] |