[Nice-commit] Nice/src/bossa/syntax polytype.nice,NONE,1.1 locals.nice,1.3,1.4 symbol.nice,1.5,1.6 P
Brought to you by:
bonniot
From: Arjan B. <ar...@us...> - 2005-01-10 20:04:56
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8578/F:/nice/src/bossa/syntax Modified Files: locals.nice symbol.nice Added Files: polytype.nice Removed Files: Polytype.java Log Message: Converted Polytype. Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** locals.nice 14 Oct 2004 09:37:27 -0000 1.3 --- locals.nice 10 Jan 2005 20:04:43 -0000 1.4 *************** *** 210,214 **** let value = createFunExp(Constraint.True, parameters.getMonoSymbols() || new MonoSymbol[0], body); let symbol = new FunSymbol(name, Constraint.True, parameters, returnType); ! notNull(notNull(symbol.syntacticType).getMonotype()).nullness = Monotype.sure; return new LocalFunction(left: symbol, value: value, parameters: parameters); } --- 210,214 ---- let value = createFunExp(Constraint.True, parameters.getMonoSymbols() || new MonoSymbol[0], body); let symbol = new FunSymbol(name, Constraint.True, parameters, returnType); ! notNull(symbol.syntacticType).monotype.nullness = Monotype.sure; return new LocalFunction(left: symbol, value: value, parameters: parameters); } --- NEW FILE: polytype.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; import bossa.util.*; /** A constrained monotype. */ public class Polytype extends Node { private Constraint constraint = Constraint.True; private Monotype monotype; { this.addChild(constraint); } mlsub.typing.Polytype resolveToLowlevel() { return new mlsub.typing.Polytype(constraint.resolveToLowlevel(), monotype.resolve(typeScope)); } mlsub.typing.Polytype resolve(TypeMap s) { // this does probably not work if constraint is non-trivial return new mlsub.typing.Polytype(constraint.resolveToLowlevel(), monotype.resolve(s)); } toString() = constraint + " " + monotype.toStringExtern(); } Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** symbol.nice 3 Jan 2005 01:24:28 -0000 1.5 --- symbol.nice 10 Jan 2005 20:04:43 -0000 1.6 *************** *** 62,68 **** } ! new PolySymbol( MonoSymbol sym ) { ! this(sym.name, syntacticType : new Polytype(sym.syntacticType)); } --- 62,68 ---- } ! new PolySymbol(MonoSymbol sym) { ! this(sym.name, syntacticType : new Polytype(Node.down, monotype: notNull(sym.syntacticType))); } *************** *** 138,142 **** { this(name, parameters: parameters, arity: parameters.size, syntacticType: ! new Polytype(constraint, createFunType(parameters.types(), returnType))); } --- 138,142 ---- { this(name, parameters: parameters, arity: parameters.size, syntacticType: ! new Polytype(Node.down, constraint: constraint, monotype: createFunType(parameters.types(), returnType))); } *************** *** 200,204 **** FormalParameters parameters = notNull(declaration.formalParameters()); this(name, declaration: declaration, parameters: parameters, arity: parameters.size, ! syntacticType: new Polytype(constraint, createFunType(parameters.types(), returnType))); } --- 200,204 ---- FormalParameters parameters = notNull(declaration.formalParameters()); this(name, declaration: declaration, parameters: parameters, arity: parameters.size, ! syntacticType: new Polytype(Node.down, constraint: constraint, monotype: createFunType(parameters.types(), returnType))); } --- Polytype.java DELETED --- |