[Nice-commit] Nice/src/bossa/syntax symbol.nice,NONE,1.1 Arguments.java,1.27,1.28 Constructor.java,1
Brought to you by:
bonniot
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7158/F:/nice/src/bossa/syntax Modified Files: Arguments.java Constructor.java CustomConstructor.java FormalParameters.java MethodBodyDefinition.java MethodDeclaration.java NiceClass.java Node.java VarSymbol.java dispatch.java.bootstrap new.nice niceclass.nice tools.nice Added Files: symbol.nice Removed Files: FunSymbol.java PolySymbol.java Log Message: Converted PolySymbol and subclasses. (patch by Luc Perrin) Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dispatch.java.bootstrap 5 Nov 2004 14:57:57 -0000 1.24 --- dispatch.java.bootstrap 21 Nov 2004 23:24:37 -0000 1.25 *************** *** 31,34 **** --- 31,43 ---- { return null; } + public static VarSymbol createMethodSymbol(MethodDeclaration declaration, LocatedString name, Constraint constraint, Monotype returnType) + { return null; } + + public static VarSymbol createMethodSymbol(MethodDeclaration declaration, LocatedString name, mlsub.typing.Polytype type) + { return null; } + + public static VarSymbol createConstructorCallSymbol(MethodDeclaration declaration, LocatedString name, mlsub.typing.Polytype type) + { return null; } + public static gnu.bytecode.Method getImplementationAbove(JavaMethod decl, gnu.bytecode.ClassType firstArg) { return null; } Index: Constructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constructor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Constructor.java 6 Nov 2004 19:39:50 -0000 1.15 --- Constructor.java 21 Nov 2004 23:24:36 -0000 1.16 *************** *** 65,75 **** (getType().getConstraint(), new mlsub.typing.FunType(getArgTypes(), PrimitiveType.voidType)); ! classe.addConstructorCallSymbol ! (new MethodDeclaration.Symbol(name, type) { ! gnu.expr.Expression compileInCallPosition() ! { ! return getInitializationCode(true); ! } ! }); } --- 65,70 ---- (getType().getConstraint(), new mlsub.typing.FunType(getArgTypes(), PrimitiveType.voidType)); ! classe.addConstructorCallSymbol( ! dispatch.createConstructorCallSymbol(this, name, type)); } Index: Node.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Node.java 17 Jun 2004 12:15:50 -0000 1.60 --- Node.java 21 Nov 2004 23:24:37 -0000 1.61 *************** *** 70,73 **** --- 70,78 ---- children.remove(n); } + + void removeChildren() + { + children = null; + } /** Index: CustomConstructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CustomConstructor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CustomConstructor.java 19 Nov 2004 22:24:59 -0000 1.23 --- CustomConstructor.java 21 Nov 2004 23:24:36 -0000 1.24 *************** *** 78,88 **** (getType().getConstraint(), new mlsub.typing.FunType(getArgTypes(), PrimitiveType.voidType)); ! classe.addConstructorCallSymbol ! (new MethodDeclaration.Symbol(name, type) { ! gnu.expr.Expression compileInCallPosition() ! { ! return getInitializationCode(true); ! } ! }); } --- 78,83 ---- (getType().getConstraint(), new mlsub.typing.FunType(getArgTypes(), PrimitiveType.voidType)); ! classe.addConstructorCallSymbol( ! dispatch.createConstructorCallSymbol(this, name, type)); } Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** NiceClass.java 18 Nov 2004 17:31:15 -0000 1.93 --- NiceClass.java 21 Nov 2004 23:24:36 -0000 1.94 *************** *** 56,60 **** } ! abstract void addConstructorCallSymbol(MethodDeclaration.Symbol sym); abstract public void addField(MonoSymbol sym, Expression value, --- 56,61 ---- } ! // FIXME change to MethodSymbol once this is converted to nice ! abstract void addConstructorCallSymbol(VarSymbol sym); abstract public void addField(MonoSymbol sym, Expression value, --- PolySymbol.java DELETED --- Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** niceclass.nice 18 Nov 2004 17:31:16 -0000 1.4 --- niceclass.nice 21 Nov 2004 23:24:37 -0000 1.5 *************** *** 33,37 **** /** List of symbols for calling constructors of this class. */ ! private List<MethodDeclaration.Symbol> constructors = new ArrayList(); private Constructor[?] constructorMethod = null; --- 33,37 ---- /** List of symbols for calling constructors of this class. */ ! private List<MethodSymbol> constructors = new ArrayList(); private Constructor[?] constructorMethod = null; *************** *** 111,118 **** addConstructorCallSymbol(sym) { ! constructors.add(sym); } ! List<MethodDeclaration.Symbol> getConstructorCallSymbols() = new LinkedList(constructors); resolveClass() --- 111,118 ---- addConstructorCallSymbol(sym) { ! constructors.add(cast(sym)); } ! List<MethodSymbol> getConstructorCallSymbols() = new LinkedList(constructors); resolveClass() --- FunSymbol.java DELETED --- Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** FormalParameters.java 6 Nov 2004 19:39:50 -0000 1.43 --- FormalParameters.java 21 Nov 2004 23:24:36 -0000 1.44 *************** *** 417,421 **** including the default values of the optional parameters not passed. */ ! boolean match(Arguments args, FunSymbol symbol) { int[] map = new int[size]; --- 417,422 ---- including the default values of the optional parameters not passed. */ ! // FIXME change VarSymbol to FunSymbol once converted to nice ! boolean match(Arguments args, VarSymbol symbol) { int[] map = new int[size]; Index: new.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/new.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** new.nice 5 Nov 2004 14:57:57 -0000 1.5 --- new.nice 21 Nov 2004 23:24:37 -0000 1.6 *************** *** 60,64 **** definition.resolve(); ! ?LinkedList<MethodDeclaration.Symbol> constructors = TypeConstructors.getConstructors(tc); if (constructors == null) { --- 60,64 ---- definition.resolve(); ! let constructors = TypeConstructors.getConstructors(tc); if (constructors == null) { --- NEW FILE: symbol.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2004 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; /** A variable symbol which has a polytype (eg a method symbol) @see MonoSymbol */ public class PolySymbol extends VarSymbol { ?mlsub.typing.Polytype type = null; ?mlsub.typing.Polytype clonedType = null; ?bossa.syntax.Polytype syntacticType = null; { if(syntacticType!=null) this.addChild(syntacticType); } getType() = notNull(type); isAssignable() = false; // No polymorphic references! resolve() { type = notNull(syntacticType).resolveToLowlevel(); syntacticType = null; this.removeChildren(); } makeClonedType() { if (clonedType != null) Internal.error(this, "clonedType in use"); clonedType = notNull(type).cloneType(); } releaseClonedType() { clonedType = null; } getClonedType() = notNull(clonedType); toString() { ?mlsub.typing.Polytype type = this.type; return (type==null ? String.valueOf(notNull(syntacticType)) : type.toString()) + " " + name; } } new PolySymbol( MonoSymbol sym ) { this(sym.name, syntacticType : new Polytype(sym.syntacticType)); } /** * A functional symbol. */ class FunSymbol extends PolySymbol { ?FormalParameters parameters; int arity; isFunSymbol() = true; getFormalParameters() = this.parameters; String describeParameters() { ?FormalParameters parameters = this.parameters; if (parameters != null) return parameters.toString(); mlsub.typing.Monotype m = nice.tools.typing.Types.rawType( notNull(this.getType()).getMonotype()); if (m instanceof mlsub.typing.FunType) return bossa.util.Util.map("", ", ", "", m.domain()); bossa.util.Internal.warning(this, "Non functional type in a functional symbol"); return ""; } /** @return 0 : doesn't match 1 : wasn't even a function 2 : matches */ match(Arguments arguments) { let parameters = this.parameters; if (parameters == null) { // true for constructors, for instance. case might be removed if (!arguments.plainApplication(arity, this)) return 0; } else if (!parameters.match(arguments, this)) return 0; return 2; } String explainWhyMatchFailsWithFunSymbol(Arguments arguments) { if (this.isFieldAccess()) { if (arguments.size() == 0) return name + " is not defined"; return name + " is a field of class " + this.describeParameters(); } return "Method " + name + " expects parameters (" + this.describeParameters() + ")"; } explainWhyMatchFails(Arguments arguments) = this.explainWhyMatchFailsWithFunSymbol(arguments); } new FunSymbol(LocatedString name, Constraint constraint, FormalParameters parameters, Monotype returnType) { this(name, parameters: parameters, arity: parameters.size, syntacticType: new Polytype(constraint, new FunType(parameters.types(), returnType))); } /** * A symbol for a declared method. */ public class MethodSymbol extends FunSymbol { MethodDeclaration declaration; getFieldAccessMethod() { let decl = this.declaration; if(decl instanceof FieldAccess) return decl; return null; } isIgnored() = this.declaration.isIgnored(); checkSpecialRequirements(arguments) = this.declaration.checkSpecialRequirements(arguments); resolve() { if (this.isIgnored()) return; // Check that resolving has not already been done. if (syntacticType != null) { super; // The method has a raw type, while the symbol needs a nullness marker declaration.type = this.type; this.type = nice.tools.typing.Types.addSure(this.type); } } getDefinition() = this.declaration; getMethodDeclaration() = this.declaration; compile() = this.declaration.getCode(); compileInCallPosition() = declaration.getCodeInCallPosition(); toString() = this.declaration.toString(); explainWhyMatchFails(Arguments arguments) = this.declaration.explainWhyMatchFails(arguments); defaultExplainWhyMatchFails(Arguments arguments) = this.explainWhyMatchFailsWithFunSymbol(arguments); } new MethodSymbol(MethodDeclaration declaration, LocatedString name, Constraint constraint, Monotype returnType ) { FormalParameters parameters = declaration.formalParameters(); this(name, declaration: declaration, parameters: parameters, arity: parameters.size, syntacticType: new Polytype(constraint, new FunType(parameters.types(), returnType))); } new MethodSymbol(MethodDeclaration declaration, LocatedString name, mlsub.typing.Polytype type) { this(name, declaration: declaration, type: nice.tools.typing.Types.addSure(type), parameters: declaration.formalParameters(), arity: declaration.arity); } // FIXME if CustomConstructor is made to extend Constructor, this code can be cleaned up class ConstructorCallSymbol extends MethodSymbol { compileInCallPosition() { let decl = this.declaration; if (decl instanceof bossa.syntax.Constructor) return decl.getInitializationCode(true); else if (decl instanceof bossa.syntax.CustomConstructor) return decl.getInitializationCode(true); Internal.error("Declaration associated with ConstructorCallSymbol is not a constructor."); return super; } } // Bootstrap (for conversion to nice) VarSymbol createMethodSymbol(MethodDeclaration declaration, LocatedString name, Constraint constraint, Monotype returnType ) = new MethodSymbol(declaration,name,constraint,returnType); VarSymbol createMethodSymbol(MethodDeclaration declaration, LocatedString name, mlsub.typing.Polytype type ) = new MethodSymbol(declaration,name,type); VarSymbol createConstructorCallSymbol(MethodDeclaration declaration, LocatedString name, mlsub.typing.Polytype type ) = new ConstructorCallSymbol(declaration,name,type); Index: MethodDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** MethodDeclaration.java 12 Oct 2004 23:35:48 -0000 1.62 --- MethodDeclaration.java 21 Nov 2004 23:24:36 -0000 1.63 *************** *** 64,68 **** syntacticConstraint = constraint.toString(); ! symbol = new MethodDeclaration.Symbol(name, constraint, returnType); symbol.propagate = Node.global; addChild(symbol); --- 64,68 ---- syntacticConstraint = constraint.toString(); ! symbol = dispatch.createMethodSymbol(this, name, constraint, returnType); symbol.propagate = Node.global; addChild(symbol); *************** *** 101,108 **** this.arity = type.domain().length; this.type = type; ! symbol = new MethodDeclaration.Symbol(name, type); } ! private Polytype type; public final Polytype getType() --- 101,108 ---- this.arity = type.domain().length; this.type = type; ! symbol = dispatch.createMethodSymbol(this, name, type); } ! Polytype type; public final Polytype getType() *************** *** 318,410 **** } ! private MethodDeclaration.Symbol symbol; ! MethodDeclaration.Symbol getSymbol() { return symbol; } ! ! public class Symbol extends FunSymbol ! { ! Symbol(LocatedString name, bossa.syntax.Constraint constraint, ! bossa.syntax.Monotype returnType) ! { ! super(name, constraint, ! MethodDeclaration.this.formalParameters(), ! returnType); ! } ! ! Symbol(LocatedString name, Polytype type) ! { ! super(name, Types.addSure(type), ! MethodDeclaration.this.formalParameters(), ! MethodDeclaration.this.arity); ! } ! ! FieldAccess getFieldAccessMethod() ! { ! if(getMethodDeclaration() instanceof FieldAccess) ! return (FieldAccess) getMethodDeclaration(); ! ! return null; ! } ! ! boolean isIgnored() ! { ! return getMethodDeclaration().isIgnored(); ! } ! ! void checkSpecialRequirements(Expression[] arguments) ! { ! getMethodDeclaration().checkSpecialRequirements(arguments); ! } ! ! void resolve() ! { ! if (isIgnored()) ! return; ! ! // Check that resolving has not already been done. ! if (syntacticType != null) ! { ! super.resolve(); ! ! // The method has a raw type, while the symbol needs a nullness marker ! MethodDeclaration.this.type = this.type; ! this.type = Types.addSure(this.type); ! } ! } ! ! public Definition getDefinition() ! { ! return MethodDeclaration.this; ! } ! ! public MethodDeclaration getMethodDeclaration() ! { ! return MethodDeclaration.this; ! } ! ! gnu.expr.Expression compile() ! { ! return getMethodDeclaration().getCode(); ! } ! ! gnu.expr.Expression compileInCallPosition() ! { ! return getMethodDeclaration().getCodeInCallPosition(); ! } ! ! String explainWhyMatchFails(Arguments arguments) ! { ! return getMethodDeclaration().explainWhyMatchFails(arguments); ! } ! ! String defaultExplainWhyMatchFails(Arguments arguments) ! { ! return super.explainWhyMatchFails(arguments); ! } ! ! public String toString() ! { ! return getMethodDeclaration().toString(); ! } ! } /**************************************************************** --- 318,324 ---- } ! // FIXME: once this class is converted to nice, Change VarSymbol to MethodSymbol ! private VarSymbol symbol; ! VarSymbol getSymbol() { return symbol; } /**************************************************************** Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** tools.nice 21 Nov 2004 18:33:17 -0000 1.61 --- tools.nice 21 Nov 2004 23:24:37 -0000 1.62 *************** *** 198,202 **** <T> String map(String, String, String, Collection<T>) = native String bossa.util.Util.map(String, String, String, Collection); Stack<bossa.link.Alternative> sortedAlternatives(MethodDeclaration) = native Stack bossa.link.Alternative.sortedAlternatives(MethodDeclaration); ! LinkedList<VarSymbol> getConstructors(mlsub.typing.TypeConstructor) = native LinkedList TypeConstructors.getConstructors(mlsub.typing.TypeConstructor); void addValues(Pattern, List<ConstantExp>) = native void Pattern.addValues(List); ?mlsub.typing.TypeConstructor getRuntimeTC(Pattern) = native mlsub.typing.TypeConstructor Pattern.getRuntimeTC(); --- 198,202 ---- <T> String map(String, String, String, Collection<T>) = native String bossa.util.Util.map(String, String, String, Collection); Stack<bossa.link.Alternative> sortedAlternatives(MethodDeclaration) = native Stack bossa.link.Alternative.sortedAlternatives(MethodDeclaration); ! ?LinkedList<VarSymbol> getConstructors(mlsub.typing.TypeConstructor) = native LinkedList TypeConstructors.getConstructors(mlsub.typing.TypeConstructor); void addValues(Pattern, List<ConstantExp>) = native void Pattern.addValues(List); ?mlsub.typing.TypeConstructor getRuntimeTC(Pattern) = native mlsub.typing.TypeConstructor Pattern.getRuntimeTC(); *************** *** 207,210 **** --- 207,211 ---- ?FieldAccess getFieldAccessMethod(Expression) = native FieldAccess Expression.getFieldAccessMethod(); ?FieldAccess getField(Expression) = native FieldAccess Expression.getField(); + ?FieldAccess getFieldAccessMethod(VarSymbol) = native FieldAccess VarSymbol.getFieldAccessMethod(); ?mlsub.typing.Monotype Types_getTypeParameter(mlsub.typing.Polytype, int) = native mlsub.typing.Monotype nice.tools.typing.Types.getTypeParameter(mlsub.typing.Polytype, int); ?mlsub.typing.Monotype Types_getTypeParameter(mlsub.typing.Monotype, int) = native mlsub.typing.Monotype nice.tools.typing.Types.getTypeParameter(mlsub.typing.Monotype, int); *************** *** 220,224 **** FormalParameters parameters(MethodDeclaration) = native MethodDeclaration.parameters; ?gnu.expr.Expression getInitializer(NiceClass) = native gnu.expr.Expression NiceClass.getInitializer(); ! void addConstructorCallSymbol(NiceClass, MethodDeclaration.Symbol) = native void NiceClass.addConstructorCallSymbol(MethodDeclaration.Symbol); gnu.expr.Expression callSuperMethod(NiceClass, gnu.bytecode.Method) = native gnu.expr.Expression NiceClass.callSuperMethod(gnu.bytecode.Method); Module module(Definition) = native Definition.module; --- 221,225 ---- FormalParameters parameters(MethodDeclaration) = native MethodDeclaration.parameters; ?gnu.expr.Expression getInitializer(NiceClass) = native gnu.expr.Expression NiceClass.getInitializer(); ! void addConstructorCallSymbol(NiceClass, VarSymbol) = native void NiceClass.addConstructorCallSymbol(VarSymbol); gnu.expr.Expression callSuperMethod(NiceClass, gnu.bytecode.Method) = native gnu.expr.Expression NiceClass.callSuperMethod(gnu.bytecode.Method); Module module(Definition) = native Definition.module; *************** *** 231,235 **** mlsub.typing.TypeSymbol[?] getBinders(MethodContainer) = native mlsub.typing.TypeSymbol[] MethodContainer.getBinders(); ?Expression value(FormalParameters.Parameter) = native Expression FormalParameters.Parameter.value(); ! ?LinkedList<MethodDeclaration.Symbol> getConstructors(TypeConstructor) = native LinkedList TypeConstructors.getConstructors(TypeConstructor); ?gnu.bytecode.Attribute get(gnu.bytecode.AttrContainer, String) = native gnu.bytecode.Attribute gnu.bytecode.Attribute.get(gnu.bytecode.AttrContainer, String); void printInterface(Definition, java.io.PrintWriter) = native void Definition.printInterface(java.io.PrintWriter); --- 232,236 ---- mlsub.typing.TypeSymbol[?] getBinders(MethodContainer) = native mlsub.typing.TypeSymbol[] MethodContainer.getBinders(); ?Expression value(FormalParameters.Parameter) = native Expression FormalParameters.Parameter.value(); ! ?LinkedList<MethodSymbol> getConstructors(TypeConstructor) = native LinkedList TypeConstructors.getConstructors(TypeConstructor); ?gnu.bytecode.Attribute get(gnu.bytecode.AttrContainer, String) = native gnu.bytecode.Attribute gnu.bytecode.Attribute.get(gnu.bytecode.AttrContainer, String); void printInterface(Definition, java.io.PrintWriter) = native void Definition.printInterface(java.io.PrintWriter); *************** *** 239,242 **** --- 240,244 ---- ClassDefinition.Class ClassDefinition_makeClass(LocatedString, boolean, boolean, ?MethodContainer.Constraint, List<?boolean>, MonotypeConstructor, ?List<TypeIdent>, ?List<TypeIdent>) = native ClassDefinition.Class ClassDefinition.makeClass(LocatedString, boolean, boolean, MethodContainer.Constraint, List, MonotypeConstructor, List, List); MethodBodyDefinition MethodBodyDefinition(NiceClass, LocatedString, ?Collection<LocatedString>, List<Pattern>, Statement) = native new MethodBodyDefinition(NiceClass, LocatedString, Collection, List, Statement); + ?FormalParameters getFormalParameters(VarSymbol) = native FormalParameters VarSymbol.getFormalParameters(); // Retypings needed since java types are not strict. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** MethodBodyDefinition.java 5 Nov 2004 15:42:42 -0000 1.156 --- MethodBodyDefinition.java 21 Nov 2004 23:24:36 -0000 1.157 *************** *** 221,225 **** if (symbols.size() > 1 && hasAdditionalTags) { ! MethodDeclaration.Symbol[] tempSymbols = new MethodDeclaration.Symbol[symbols.size()]; symbols.toArray(tempSymbols); int size = symbols.size(); --- 221,226 ---- if (symbols.size() > 1 && hasAdditionalTags) { ! // FIXME change to MethodSymbol[] once converted to nice. ! VarSymbol[] tempSymbols = new VarSymbol[symbols.size()]; symbols.toArray(tempSymbols); int size = symbols.size(); *************** *** 268,272 **** // Check that the non-dispatched parameter names match the declaration outer: for(Iterator it = symbols.iterator(); it.hasNext();) { ! MethodDeclaration m = ((MethodDeclaration.Symbol) it.next()).getMethodDeclaration(); if( m instanceof NiceMethod) { FormalParameters params = m.formalParameters(); --- 269,273 ---- // Check that the non-dispatched parameter names match the declaration outer: for(Iterator it = symbols.iterator(); it.hasNext();) { ! MethodDeclaration m = ((VarSymbol) it.next()).getMethodDeclaration(); if( m instanceof NiceMethod) { FormalParameters params = m.formalParameters(); *************** *** 301,306 **** for(Iterator i = symbols.iterator(); i.hasNext();) { ! MethodDeclaration m = ! ((MethodDeclaration.Symbol) i.next()).getMethodDeclaration(); methods += m + " defined " + m.location() + "\n"; } --- 302,306 ---- for(Iterator i = symbols.iterator(); i.hasNext();) { ! MethodDeclaration m = ((VarSymbol) i.next()).getMethodDeclaration(); methods += m + " defined " + m.location() + "\n"; } Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Arguments.java 6 Nov 2004 19:39:50 -0000 1.27 --- Arguments.java 21 Nov 2004 23:24:36 -0000 1.28 *************** *** 235,241 **** for (Iterator i = noMatches.iterator(); i.hasNext();) { ! Object noMatch = i.next(); ! if (noMatch instanceof FunSymbol) ! argnames.retainAll(noMatchByName(((FunSymbol)noMatch).parameters)); } if (!argnames.isEmpty()) --- 235,241 ---- for (Iterator i = noMatches.iterator(); i.hasNext();) { ! VarSymbol noMatch = (VarSymbol)i.next(); ! if (noMatch.isFunSymbol()) ! argnames.retainAll(noMatchByName(noMatch.getFormalParameters())); } if (!argnames.isEmpty()) Index: VarSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarSymbol.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** VarSymbol.java 23 Jun 2004 19:38:09 -0000 1.37 --- VarSymbol.java 21 Nov 2004 23:24:37 -0000 1.38 *************** *** 86,89 **** --- 86,102 ---- } + boolean isFunSymbol() + { + return false; + } + + /** + * Get the FormalParameters, or null if this is not a functional symbol + */ + FormalParameters getFormalParameters() + { + return null; + } + abstract Polytype getType(); *************** *** 103,106 **** --- 116,127 ---- } + /** + * Specialized by MethodSymbol only. + */ + String defaultExplainWhyMatchFails(Arguments arguments) + { + return explainWhyMatchFails(arguments); + } + /** This returns a generic explanation. A more precise message should be returned if possible in subclasses. |