nice-commit Mailing List for The Nice Programming Language (Page 69)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2003-12-09 17:26:06
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv5687/web Modified Files: Makefile Log Message: Do not keep webpages if the transformation was not successful. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/web/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Makefile 9 Aug 2003 21:44:35 -0000 1.13 --- Makefile 9 Dec 2003 17:26:03 -0000 1.14 *************** *** 36,40 **** %.html: %.xml new.xsl ! $(PROC) new.xsl $*.xml > $@ # Old style --- 36,40 ---- %.html: %.xml new.xsl ! if ! $(PROC) new.xsl $*.xml > $@; then rm $@; fi # Old style |
From: <bo...@us...> - 2003-12-09 17:24:08
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements In directory sc8-pr-cvs1:/tmp/cvs-serv5417/testsuite/compiler/statements Modified Files: exceptions.testsuite Log Message: The error now gets reported at a different location, which is equally valid. Index: exceptions.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/exceptions.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** exceptions.testsuite 6 Dec 2002 15:36:19 -0000 1.1 --- exceptions.testsuite 9 Dec 2003 17:24:03 -0000 1.2 *************** *** 1,2 **** /// FAIL ! throw /*/// FAIL HERE */ java.lang.Exception; --- 1,2 ---- /// FAIL ! /*/// FAIL HERE */ throw java.lang.Exception; |
From: <bo...@us...> - 2003-12-09 17:20:19
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv4856/src/bossa/syntax Modified Files: typecheck.nice analyse.nice TypeConstantExp.java Removed Files: ClassExp.java Log Message: Unified handling of expressions that represent classes/types under TypeConstantExpression, which has a proper type and can be manipulated by user code. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** typecheck.nice 9 Dec 2003 16:06:04 -0000 1.94 --- typecheck.nice 9 Dec 2003 17:20:14 -0000 1.95 *************** *** 654,658 **** } - typecheck(e@ClassExp) {} typecheck(c@ConstantExp){} typecheck(e@NullExp) {} --- 654,657 ---- Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** analyse.nice 9 Dec 2003 16:06:04 -0000 1.93 --- analyse.nice 9 Dec 2003 17:20:15 -0000 1.94 *************** *** 326,330 **** throw unknownIdent(notNull(pkg.locatedName())); ! return ClassExp.create(pkg, nextComponent); } } --- 326,330 ---- throw unknownIdent(notNull(pkg.locatedName())); ! return TypeConstantExp.create(pkg, nextComponent); } } *************** *** 520,527 **** if (e.enableClassExp) ! return notNull(ClassExp.create(e.ident)); ! ! //if (e.infix) ! //return e; throw unknownIdent(notNull(e.ident)); --- 520,524 ---- if (e.enableClassExp) ! return notNull(TypeConstantExp.create(e.ident)); throw unknownIdent(notNull(e.ident)); Index: TypeConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeConstantExp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeConstantExp.java 27 Aug 2003 09:33:45 -0000 1.3 --- TypeConstantExp.java 9 Dec 2003 17:20:15 -0000 1.4 *************** *** 27,30 **** --- 27,83 ---- } + private TypeConstantExp(LocatedString name, gnu.bytecode.Type type) + { + this(name); + this.value = type; + } + + /** + @return an Expression representing ident as a type or package literal. + */ + static Expression create(LocatedString ident) + { + return create(null, ident); + } + + /** + @return an Expression representing [root].[name] + */ + static Expression create(PackageExp root, LocatedString name) + { + String fullName = name.toString(); + if (root != null) + fullName = root.name.append(".").append(fullName).toString(); + + mlsub.typing.TypeConstructor tc = + Node.getGlobalTypeScope().globalLookup(fullName, name.location()); + + if(tc != null) + { + gnu.bytecode.Type type = nice.tools.code.Types.javaType(tc); + // type might not be a class + // for instance if the ident was "int" + if (type instanceof gnu.bytecode.ClassType) + { + Expression res = new TypeConstantExp(name, type); + res.setLocation(root == null ? name.location() : root.location()); + return res; + } + } + + if (root != null) + // name has been appended to root's name + return root; + + root = new PackageExp(fullName); + root.setLocation(name.location()); + return root; + } + + gnu.bytecode.ClassType staticClass() + { + return (gnu.bytecode.ClassType) value; + } + mlsub.typing.TypeConstructor representedType; } --- ClassExp.java DELETED --- |
From: <bo...@us...> - 2003-12-09 17:20:17
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1:/tmp/cvs-serv4856/testsuite/compiler/native Modified Files: types.testsuite Log Message: Unified handling of expressions that represent classes/types under TypeConstantExpression, which has a proper type and can be manipulated by user code. Index: types.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/native/types.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** types.testsuite 24 Jan 2003 12:25:11 -0000 1.1 --- types.testsuite 9 Dec 2003 17:20:14 -0000 1.2 *************** *** 1,2 **** --- 1,18 ---- /// PASS Class c = Byte.TYPE; + + /// PASS + /// package a + /// Toplevel + class A { + Class c = java.lang.String.class; + } + /// package b import a + {} + + /// PASS + /// package a + /// Toplevel + void foo(Class c = java.lang.String.class) {} + /// package b import a + {} |
From: <bo...@us...> - 2003-12-09 16:06:07
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv22587/src/bossa/syntax Modified Files: typecheck.nice analyse.nice Log Message: Minor. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** typecheck.nice 8 Dec 2003 17:21:34 -0000 1.93 --- typecheck.nice 9 Dec 2003 16:06:04 -0000 1.94 *************** *** 254,259 **** nullnessInfo(test@CallExp) { - (?List<MonoSymbol>, ?List<MonoSymbol>) res; - if (test.isCallTo("||")) { --- 254,257 ---- Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** analyse.nice 30 Nov 2003 13:09:20 -0000 1.92 --- analyse.nice 9 Dec 2003 16:06:04 -0000 1.93 *************** *** 393,397 **** return e; ! } ?Expression analyse(Expression e, Info info, boolean noEscape) = --- 393,397 ---- return e; ! } ?Expression analyse(Expression e, Info info, boolean noEscape) = |
From: <ar...@us...> - 2003-12-09 15:21:08
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv13951/F:/nice/src/bossa/syntax Modified Files: Arguments.java ClassDefinition.java Expression.java ImplementsCst.java Node.java OverloadedSymbolExp.java SuperExp.java TypeIdent.java TypeParameters.java VarScope.java VarSymbol.java Log Message: Removed unused methods. Index: Arguments.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Arguments.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Arguments.java 22 Nov 2003 16:37:39 -0000 1.21 --- Arguments.java 9 Dec 2003 15:21:05 -0000 1.22 *************** *** 193,201 **** return true; } - - public gnu.expr.Expression[] compile() - { - return null; //Expression.compile(arguments); - } public String toString() --- 193,196 ---- Index: ClassDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassDefinition.java,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** ClassDefinition.java 15 Nov 2003 17:25:47 -0000 1.99 --- ClassDefinition.java 9 Dec 2003 15:21:05 -0000 1.100 *************** *** 676,692 **** } - final ClassType javaClass() - { - return (ClassType) javaType; - } - - static final Type javaClass(ClassDefinition c) - { - if (c == null) - return gnu.bytecode.Type.pointer_type; - - return c.getJavaType(); - } - /**************************************************************** * Printing --- 676,679 ---- Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Expression.java 22 Jul 2003 12:09:05 -0000 1.52 --- Expression.java 9 Dec 2003 15:21:05 -0000 1.53 *************** *** 132,149 **** } - /** - * Iterates the resolveOverloading() method. - */ - static List /* of Expression */ noOverloading(List expressions) - { - Iterator i=expressions.iterator(); - List res=new ArrayList(expressions.size()); - - while(i.hasNext()) - res.add( ((Expression) i.next()) .noOverloading()); - - return res; - } - /** computes the static type of the expression */ abstract void computeType(); --- 132,135 ---- *************** *** 160,180 **** return type; } - - /** - * Maps getType over a collection of Expressions - * - * @param Expressions the list of Expressions - * @return the list of their PolyTypes - */ - static Polytype[] getType(List expressions) - { - Polytype[] res = new Polytype[expressions.size()]; - - int n = 0; - for(Iterator i=expressions.iterator(); i.hasNext();) - res[n++] = ((Expression) i.next()).getType(); - - return res; - } /** --- 146,149 ---- *************** *** 234,253 **** // Default implementation. return generateCode(); - } - - /** - * Maps {@link #generateCode()} over a list of expressions. - */ - public static gnu.expr.Expression[] compile(List expressions) - { - gnu.expr.Expression[] res = new gnu.expr.Expression[expressions.size()]; - int n = 0; - for(Iterator i = expressions.iterator(); i.hasNext();n++) - { - Expression exp = (Expression)i.next(); - res[n] = exp.generateCode(); - } - - return res; } --- 203,206 ---- Index: ImplementsCst.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ImplementsCst.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ImplementsCst.java 11 Oct 2000 09:35:15 -0000 1.5 --- ImplementsCst.java 9 Dec 2003 15:21:05 -0000 1.6 *************** *** 57,69 **** } - /* - String getParentFor(TypeConstructor tc) - { - if(this.tc==tc) - return def().toString(); - else - return null; - } - */ TypeIdent tc, itf; } --- 57,60 ---- Index: Node.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Node.java 28 Nov 2003 14:01:29 -0000 1.58 --- Node.java 9 Dec 2003 15:21:05 -0000 1.59 *************** *** 72,85 **** } - final Statement child(Statement n) - { - if(n==null) - return null; - - if (children == null) children=new ArrayList(); - children.add(n); - return n; - } - void removeChild(Node n) { --- 72,75 ---- *************** *** 90,101 **** } - void removeChildren(List c) - { - if(c==null) return; - for(Iterator i = c.iterator(); - i.hasNext();) - removeChild((Node) i.next()); - } - /** * Always returns the argument (except an empty list for 'null'). --- 80,83 ---- *************** *** 112,121 **** return c; } - - void addChildren(Node[] values) - { - for (int i = 0; i < values.length; i++) - addChild(values[i]); - } void addSymbol(VarSymbol s) --- 94,97 ---- *************** *** 126,139 **** } - void addSymbols(Collection c) - { - if(c!=null) - { - if (varSymbols == null) - varSymbols = new ArrayList(); - varSymbols.addAll(c); - } - } - void addTypeSymbol(TypeSymbol s) { --- 102,105 ---- *************** *** 160,179 **** typeMapsNames.add(name); typeMapsSymbols.add(symbol); - } - - void addTypeMaps(Collection names, Collection symbols) - { - if(names.size()!=symbols.size()) - throw new Error(symbols.size()+" != "+names.size()); - - if (typeMapsNames == null) - { - typeMapsNames = new ArrayList(); - typeMapsSymbols = new ArrayList(); - } - - for(Iterator n = names.iterator();n.hasNext();) - typeMapsNames.add(((LocatedString) n.next()).toString()); - typeMapsSymbols.addAll(symbols); } --- 126,129 ---- Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** OverloadedSymbolExp.java 8 Nov 2003 20:31:53 -0000 1.61 --- OverloadedSymbolExp.java 9 Dec 2003 15:21:05 -0000 1.62 *************** *** 56,69 **** } - OverloadedSymbolExp(VarSymbol[] symbols, LocatedString ident) - { - this.symbols = new ArrayList(symbols.length); - for (int i = 0; i < symbols.length; i++) - this.symbols.add(symbols[i]); - - this.ident = ident; - setLocation(ident.location()); - } - public boolean isAssignable() { --- 56,59 ---- Index: SuperExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/SuperExp.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SuperExp.java 29 Aug 2003 17:41:45 -0000 1.12 --- SuperExp.java 9 Dec 2003 15:21:05 -0000 1.13 *************** *** 110,118 **** } - private boolean leq(MethodBodyDefinition a, MethodBodyDefinition b) - { - return mlsub.typing.Typing.testRigidLeq(a.firstArgument(), b.firstArgument()); - } - /**************************************************************** * Typing --- 110,113 ---- Index: TypeIdent.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeIdent.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** TypeIdent.java 3 Dec 2003 21:50:41 -0000 1.25 --- TypeIdent.java 9 Dec 2003 15:21:05 -0000 1.26 *************** *** 164,180 **** } - public static TypeConstructor[] resolveToTC(TypeMap scope, List idents) - { - if (idents==null || idents.size()==0) return null; - - TypeConstructor[] res = new TypeConstructor[idents.size()]; - - int n = 0; - for(Iterator i = idents.iterator(); i.hasNext();) - res[n++] = ((TypeIdent) i.next()).resolveToTC(scope); - - return res; - } - public static Interface[] resolveToItf(TypeMap scope, List idents) { --- 164,167 ---- Index: TypeParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeParameters.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TypeParameters.java 1 Aug 2002 00:25:32 -0000 1.17 --- TypeParameters.java 9 Dec 2003 15:21:05 -0000 1.18 *************** *** 41,51 **** } - TypeParameters(LocatedString s, Variance v) - { - if (v == null) - Internal.error(s, s + " has no variance"); - this.content = Monotype.freshs(v.arity(), s); - } - mlsub.typing.Monotype[] resolve(TypeMap ts) { --- 41,44 ---- *************** *** 56,64 **** { return Util.map("<",", ",">", content); - } - - public int size() - { - return content.length; } --- 49,52 ---- Index: VarScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** VarScope.java 28 Nov 2003 14:01:29 -0000 1.18 --- VarScope.java 9 Dec 2003 15:21:05 -0000 1.19 *************** *** 94,119 **** } - /** - * Verifies that a collection of VarSymbol - * does not contains twice the same identifier - * - * @param symbols the collection of VarSymbols - * @exception DuplicateIdentEx if the same identifer occurs twice - */ - static void checkDuplicates(Collection symbols) - throws DuplicateIdentEx - { - LocatedString name; - Collection seen = new ArrayList(symbols.size()); - Iterator i = symbols.iterator(); - while(i.hasNext()) - { - name = ((VarSymbol)i.next()).name; - if(seen.contains(name)) - throw new DuplicateIdentEx(name); - seen.add(name); - } - } - /**************************************************************** * Debugging --- 94,97 ---- Index: VarSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarSymbol.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** VarSymbol.java 7 Nov 2003 23:34:19 -0000 1.35 --- VarSymbol.java 9 Dec 2003 15:21:05 -0000 1.36 *************** *** 88,109 **** abstract Polytype getType(); - /** - * Maps getType over a collection of VarSymbols - * - * @param varsymbols the colleciton of Varsymbols - * @return the collection of their Types - */ - static Polytype[] getType(Collection varsymbols) - { - Iterator i=varsymbols.iterator(); - Polytype[] res = new Polytype[varsymbols.size()]; - - int n = 0; - while(i.hasNext()) - res[n++] = ((VarSymbol) i.next()).getType(); - - return res; - } - /**************************************************************** * Overloading resolution --- 88,91 ---- |
From: <bo...@us...> - 2003-12-08 20:54:26
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1:/tmp/cvs-serv28146 Modified Files: NEWS Log Message: Object super-type. Polytype simplification. Clarify changes for dynamic type inference. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NEWS 1 Dec 2003 23:51:47 -0000 1.4 --- NEWS 8 Dec 2003 20:54:23 -0000 1.5 *************** *** 25,29 **** equals(Dummy other) = this.x == other.x; } ! * Stricter typechecking of anonymous and local functions. * Reduced memory usage when repeatedly compiling in the same JVM (eclipse plugin, ant, testsuite, ...). --- 25,33 ---- equals(Dummy other) = this.x == other.x; } ! * Object is now recognized as a super-type of every type. This allows ! easier use of Java libraries, creation of heterogeneous collections, ! and type-safe handling of values with unknown types. ! * Simplified some complex type in error messages. ! * Safe dynamic type inference in presence of anonymous and local functions. * Reduced memory usage when repeatedly compiling in the same JVM (eclipse plugin, ant, testsuite, ...). |
From: <bo...@us...> - 2003-12-08 19:46:14
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv14897/testsuite/compiler/methods Modified Files: parameterTypeNaming.testsuite Log Message: The first testcase was not safe, as shown by the new testcase. Mark the other as bug for now, it should be possible to handle it in a slightly different form. Index: parameterTypeNaming.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/parameterTypeNaming.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** parameterTypeNaming.testsuite 28 Apr 2003 20:57:52 -0000 1.3 --- parameterTypeNaming.testsuite 8 Dec 2003 19:46:09 -0000 1.4 *************** *** 1,3 **** ! /// PASS /// Toplevel <Collection C, T, U> C<U> bar(C<T>, T->U); --- 1,27 ---- ! /// FAIL ! B /* FAIL HERE*/ b = bar(new B()); ! /// Toplevel ! interface I {} ! <I T> T foo(T); ! ! <I T> T bar(T t); ! ! class A implements I {} ! bar(#A x) = x; ! foo(#A x) = x; ! ! <T> bar(x@B : X) ! { ! X /*/// FAIL HERE*/ res = foo(x); ! bug(res); ! return res; ! } ! ! class B extends A { ! void bug() {} ! } ! foo(#B) = new A(); ! ! /// PASS bug /// Toplevel <Collection C, T, U> C<U> bar(C<T>, T->U); |
From: <bo...@us...> - 2003-12-08 19:43:24
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1:/tmp/cvs-serv14452/src/mlsub/typing Modified Files: Polytype.java Log Message: Guarantee that simplified polytypes are simpler than the original. Index: Polytype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Polytype.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Polytype.java 26 Jul 2003 22:29:47 -0000 1.19 --- Polytype.java 8 Dec 2003 19:43:21 -0000 1.20 *************** *** 285,291 **** } monotype = monotype.canonify(); - int nbinders = binders.size(), natoms = atoms.size(); constraint = Constraint.create (nbinders == 0 ? null --- 285,300 ---- } + int nbinders = binders.size(), natoms = atoms.size(); + + if (nbinders >= constraint.binders().length) + { + // The "simplified" version is longer than the original, so we + // keep the original. + simplified = true; + return; + } + monotype = monotype.canonify(); constraint = Constraint.create (nbinders == 0 ? null |
From: <bo...@us...> - 2003-12-08 19:42:40
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv14314/src/bossa/syntax Modified Files: PrimitiveType.java LiteralArrayExp.java Log Message: Allow inhomogenous literal arrays (with type Object[]). Index: PrimitiveType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/PrimitiveType.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PrimitiveType.java 5 Dec 2003 17:52:30 -0000 1.8 --- PrimitiveType.java 8 Dec 2003 19:42:37 -0000 1.9 *************** *** 172,175 **** --- 172,185 ---- static Polytype voidPolytype, boolPolytype, bytePolytype, shortPolytype, intPolytype, longPolytype; + private static Polytype objectPolytype; + static Polytype objectPolytype() + { + if (objectPolytype == null) + objectPolytype = new Polytype(mlsub.typing.Constraint.True, + Monotype.sure(TopMonotype.instance)); + + return objectPolytype; + } + public static TypeConstructor maybeTC, sureTC, nullTC; Index: LiteralArrayExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/LiteralArrayExp.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** LiteralArrayExp.java 28 May 2003 12:57:26 -0000 1.15 --- LiteralArrayExp.java 8 Dec 2003 19:42:37 -0000 1.16 *************** *** 41,53 **** { Polytype elementType = Polytype.union(getType(elements)); ! this.type = new Polytype (elementType.getConstraint(), bossa.syntax.Monotype.sure(new MonotypeConstructor (PrimitiveType.arrayTC, new Monotype[]{elementType.getMonotype()}))); ! ! nice.tools.code.Types.setBytecodeType(this.type); } ! /**************************************************************** * Code generation --- 41,66 ---- { Polytype elementType = Polytype.union(getType(elements)); + + type = array(elementType); + + // If the type cannot be simplified, it must be because elements + // have incomparable types. In this case, we give the array the type + // Object[]. + if (! type.trySimplify()) + type = array(PrimitiveType.objectPolytype()); ! nice.tools.code.Types.setBytecodeType(type); ! } ! ! private Polytype array(Polytype elementType) ! { ! Polytype res = new Polytype (elementType.getConstraint(), bossa.syntax.Monotype.sure(new MonotypeConstructor (PrimitiveType.arrayTC, new Monotype[]{elementType.getMonotype()}))); ! res.setNotSimplified(); ! return res; } ! /**************************************************************** * Code generation |
From: <bo...@us...> - 2003-12-08 19:42:40
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv14314/testsuite/compiler/typing Modified Files: object.testsuite Log Message: Allow inhomogenous literal arrays (with type Object[]). Index: object.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/object.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** object.testsuite 3 Dec 2003 21:50:40 -0000 1.1 --- object.testsuite 8 Dec 2003 19:42:37 -0000 1.2 *************** *** 58,61 **** ?Object o = null; ! /// PASS bug ! Object[] os = [ "DEF", 1, o ]; --- 58,69 ---- ?Object o = null; ! /// PASS ! Object[] os = [ "DEF", 42 ]; ! foo(os); ! /// Toplevel ! void foo(Object[] os) {} ! ! /// PASS ! use(["s"]); ! /// Toplevel ! void use(Object[]) {} |
From: <ar...@us...> - 2003-12-08 18:39:25
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv1646/F:/nice/src/bossa/syntax Modified Files: MethodDeclaration.java Log Message: Removed unused method. Index: MethodDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** MethodDeclaration.java 28 Nov 2003 13:52:08 -0000 1.51 --- MethodDeclaration.java 8 Dec 2003 18:39:21 -0000 1.52 *************** *** 394,406 **** protected abstract gnu.expr.Expression computeCode(); ! ! final void setCode(gnu.expr.Expression code) ! { ! if(this.code != null) ! Internal.error("code already set"); ! ! this.code = code; ! } ! gnu.expr.Expression getCode() { --- 394,398 ---- protected abstract gnu.expr.Expression computeCode(); ! gnu.expr.Expression getCode() { |
From: <bo...@us...> - 2003-12-08 18:37:14
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1:/tmp/cvs-serv1306/src/nice/tools/testsuite Modified Files: TestCase.java NiceSourceFile.java Log Message: Correctly count line numbers at toplevel if there is also a main section. Index: TestCase.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** TestCase.java 27 Nov 2003 22:45:59 -0000 1.26 --- TestCase.java 8 Dec 2003 18:37:11 -0000 1.27 *************** *** 523,526 **** --- 523,530 ---- // plus two lines for the main section header. res += _sourceFile.getTopLevelSectionLength() + 2; + else + // The main method is moved after toplevel, so adjust by removing + // that count. + res -= _sourceFile.getMainSectionLength(); return res; } Index: NiceSourceFile.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/NiceSourceFile.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NiceSourceFile.java 6 Jun 2003 10:09:04 -0000 1.17 --- NiceSourceFile.java 8 Dec 2003 18:37:11 -0000 1.18 *************** *** 65,68 **** --- 65,75 ---- private int _topLevelSectionLength = 0; + + /** + * Number of lines in the main method section. + */ + + private int _mainSectionLength = 0; + /** * TODO *************** *** 148,151 **** --- 155,159 ---- public void addToMainMethod(String line) { _mainMethodContent.append(line).append('\n'); + _mainSectionLength++; } *************** *** 163,166 **** --- 171,178 ---- public int getTopLevelSectionLength() { return _topLevelSectionLength; + } + + public int getMainSectionLength() { + return _mainSectionLength; } |
From: <bo...@us...> - 2003-12-08 17:21:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv16280/src/bossa/syntax Modified Files: typecheck.nice Log Message: Typo. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** typecheck.nice 30 Nov 2003 15:23:04 -0000 1.92 --- typecheck.nice 8 Dec 2003 17:21:34 -0000 1.93 *************** *** 687,691 **** if (! target.used) ! bossa.util.User.warning(decl, " Unused local variable " + target.name); ?Expression value = decl.value; --- 687,691 ---- if (! target.used) ! bossa.util.User.warning(decl, "Unused local variable " + target.name); ?Expression value = decl.value; |
From: <ar...@us...> - 2003-12-08 13:45:24
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv5959/F:/nice/testsuite/lib/nice/lang Modified Files: numeric.testsuite Log Message: Reversed a part of the optimization to BitOp. Index: numeric.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/nice/lang/numeric.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** numeric.testsuite 17 Jun 2003 04:30:46 -0000 1.7 --- numeric.testsuite 8 Dec 2003 13:45:21 -0000 1.8 *************** *** 119,120 **** --- 119,126 ---- } catch(Throwable e) {} assert ok; + + /// PASS + int x = 0; + x[10] = true; + boolean[] y = [x[10]]; + assert y[0]; |
From: <ar...@us...> - 2003-12-08 13:45:24
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv5959/F:/nice/stdlib/nice/lang/inline Modified Files: BitOp.java Log Message: Reversed a part of the optimization to BitOp. Index: BitOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/BitOp.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BitOp.java 30 Nov 2003 00:34:55 -0000 1.4 --- BitOp.java 8 Dec 2003 13:45:21 -0000 1.5 *************** *** 78,81 **** --- 78,89 ---- code.emitFi(); } + else + { + code.emitIfIntNotZero(); + code.emitPushBoolean(true); + code.emitElse(); + code.emitPushBoolean(false); + code.emitFi(); + } target.compileFromStack(comp, Type.boolean_type); |
From: <bo...@us...> - 2003-12-05 17:52:33
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv27181/src/bossa/syntax Modified Files: PrimitiveType.java Log Message: Minor (use more imports to simplify code). Index: PrimitiveType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/PrimitiveType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PrimitiveType.java 31 Aug 2003 00:32:56 -0000 1.7 --- PrimitiveType.java 5 Dec 2003 17:52:30 -0000 1.8 *************** *** 20,23 **** --- 20,25 ---- import mlsub.typing.TypeConstructor; import mlsub.typing.MonotypeConstructor; + import mlsub.typing.Polytype; + import mlsub.typing.Constraint; import nice.tools.code.SpecialTypes; *************** *** 62,66 **** byteTC = tc; byteType = Monotype.sure(new MonotypeConstructor(tc, null)); ! bytePolytype = new mlsub.typing.Polytype(byteType); return SpecialTypes.byteType; } --- 64,68 ---- byteTC = tc; byteType = Monotype.sure(new MonotypeConstructor(tc, null)); ! bytePolytype = new Polytype(byteType); return SpecialTypes.byteType; } *************** *** 70,74 **** shortTC = tc; shortType = Monotype.sure(new MonotypeConstructor(tc, null)); ! shortPolytype = new mlsub.typing.Polytype(shortType); return SpecialTypes.shortType; } --- 72,76 ---- shortTC = tc; shortType = Monotype.sure(new MonotypeConstructor(tc, null)); ! shortPolytype = new Polytype(shortType); return SpecialTypes.shortType; } *************** *** 78,82 **** intTC = tc; intType = Monotype.sure(new MonotypeConstructor(tc, null)); ! intPolytype = new mlsub.typing.Polytype(intType); return SpecialTypes.intType; } --- 80,84 ---- intTC = tc; intType = Monotype.sure(new MonotypeConstructor(tc, null)); ! intPolytype = new Polytype(intType); return SpecialTypes.intType; } *************** *** 86,90 **** longTC = tc; longType = Monotype.sure(new MonotypeConstructor(tc, null)); ! longPolytype = new mlsub.typing.Polytype(longType); return SpecialTypes.longType; } --- 88,92 ---- longTC = tc; longType = Monotype.sure(new MonotypeConstructor(tc, null)); ! longPolytype = new Polytype(longType); return SpecialTypes.longType; } *************** *** 96,100 **** falseBoolTC = new TypeConstructor("false"); boolType = Monotype.sure(new MonotypeConstructor(tc, null)); ! boolPolytype = new mlsub.typing.Polytype(boolType); return SpecialTypes.booleanType; } --- 98,102 ---- falseBoolTC = new TypeConstructor("false"); boolType = Monotype.sure(new MonotypeConstructor(tc, null)); ! boolPolytype = new Polytype(boolType); return SpecialTypes.booleanType; } *************** *** 119,124 **** mlsub.typing.lowlevel.Engine.setTop(tc); voidType = Monotype.sure(new MonotypeConstructor(tc, null)); ! voidPolytype = new mlsub.typing.Polytype ! (mlsub.typing.Constraint.True, voidType); synVoidType = Monotype.create(voidType); return SpecialTypes.voidType; --- 121,125 ---- mlsub.typing.lowlevel.Engine.setTop(tc); voidType = Monotype.sure(new MonotypeConstructor(tc, null)); ! voidPolytype = new Polytype(Constraint.True, voidType); synVoidType = Monotype.create(voidType); return SpecialTypes.voidType; *************** *** 169,173 **** public static mlsub.typing.Monotype byteType, charType, intType, longType, boolType, shortType, doubleType, floatType, voidType; ! static mlsub.typing.Polytype voidPolytype, boolPolytype, bytePolytype, shortPolytype, intPolytype, longPolytype; public static TypeConstructor maybeTC, sureTC, nullTC; --- 170,174 ---- public static mlsub.typing.Monotype byteType, charType, intType, longType, boolType, shortType, doubleType, floatType, voidType; ! static Polytype voidPolytype, boolPolytype, bytePolytype, shortPolytype, intPolytype, longPolytype; public static TypeConstructor maybeTC, sureTC, nullTC; *************** *** 183,193 **** } ! private static mlsub.typing.Polytype throwableType; ! static mlsub.typing.Polytype throwableType() { if (throwableType == null) { ! throwableType = new mlsub.typing.Polytype ! (mlsub.typing.Constraint.True, Monotype.sure(new MonotypeConstructor(throwableTC(), null))); } --- 184,194 ---- } ! private static Polytype throwableType; ! static Polytype throwableType() { if (throwableType == null) { ! throwableType = new Polytype ! (Constraint.True, Monotype.sure(new MonotypeConstructor(throwableTC(), null))); } |
From: <ar...@us...> - 2003-12-04 23:44:36
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv15311/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Removed static field in the parser. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.221 retrieving revision 1.222 diff -C2 -d -r1.221 -r1.222 *** Parser.jj 4 Dec 2003 13:34:28 -0000 1.221 --- Parser.jj 4 Dec 2003 23:44:32 -0000 1.222 *************** *** 52,56 **** return new IdentExp(new LocatedString(name, loc)); } - static List globalDefinitions; } PARSER_END(Parser) --- 52,55 ---- *************** *** 1032,1036 **** LOOKAHEAD( methodBodyDefinitionLookahead() ) m = methodBodyDefinition(impl) ! { globalDefinitions.add(m); } | m = internalMethodOrFunction(res) --- 1031,1035 ---- LOOKAHEAD( methodBodyDefinitionLookahead() ) m = methodBodyDefinition(impl) ! { definitions.add(m); } | m = internalMethodOrFunction(res) *************** *** 1039,1043 **** methods = new ArrayList(5); methods.add(m); - //globalDefinitions.add(m); } ) --- 1038,1041 ---- *************** *** 1502,1506 **** { Definition d; - globalDefinitions = definitions; Token t; } --- 1500,1503 ---- |
From: <bo...@us...> - 2003-12-04 16:20:00
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1:/tmp/cvs-serv11148/testsuite/compiler/classes/constructors Added Files: custom.testsuite Log Message: Added example code using a custom constructor. --- NEW FILE: custom.testsuite --- /// PASS bug var p = new Point(angle: 0, distance: 1); assert abs(p.x - 1) < 0.01 && abs(p.y) < 0.01; p = new ColoredPoint(angle: 0, distance: 1, color: "red"); assert abs(p.x - 1) < 0.01 && abs(p.y) < 0.01; /// Toplevel class Point { double x; double y; } new Point(double angle, double distance) { this(x: distance * cos(angle), y: distance * sin(angle)); } class ColoredPoint extends Point { String color; } |
From: <ar...@us...> - 2003-12-04 13:34:32
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv9889/F:/nice/src/bossa/parser Modified Files: Parser.jj Loader.java Log Message: Make it possible to store nicedoc strings in the ast. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.220 retrieving revision 1.221 diff -C2 -d -r1.220 -r1.221 *** Parser.jj 1 Dec 2003 23:43:50 -0000 1.220 --- Parser.jj 4 Dec 2003 13:34:28 -0000 1.221 *************** *** 921,925 **** } ! List getField(NiceClass c, List fields, List overrides): { MonoSymbol field; --- 921,925 ---- } ! List getField(NiceClass c, List fields, List overrides, boolean storeDocString): { MonoSymbol field; *************** *** 927,933 **** boolean isOverride = false; Expression value = null; ! Token t = null; } { ( "override" { isOverride = true; } --- 927,938 ---- boolean isOverride = false; Expression value = null; ! Token t = getToken(1); ! String docString = null; } { + { + if (storeDocString && t.specialToken != null && t.specialToken.kind == FORMAL_COMMENT) + docString = t.specialToken.image; + } ( "override" { isOverride = true; } *************** *** 954,958 **** } else ! fields.add(c.makeField(field, value, isFinal, isTransient, isVolatile)); return overrides; --- 959,963 ---- } else ! fields.add(c.makeField(field, value, isFinal, isTransient, isVolatile, docString)); return overrides; *************** *** 962,966 **** // The constraint prefixing the class keyword is optional // It is useful for complex constraints ! ClassDefinition classDefinition(Constraint cst, List definitions): { ClassDefinition res; --- 967,971 ---- // The constraint prefixing the class keyword is optional // It is useful for complex constraints ! ClassDefinition classDefinition(Constraint cst, List definitions, boolean storeDocString): { ClassDefinition res; *************** *** 1021,1034 **** | LOOKAHEAD( getField(null, null) ) ! overrides = getField(impl, fields, overrides) ! | [ "public" | "private" ] ( LOOKAHEAD( methodBodyDefinitionLookahead() ) ! { MethodBodyDefinition mb; } ! mb = methodBodyDefinition(impl) ! { globalDefinitions.add(mb); } | - { Definition m; } m = internalMethodOrFunction(res) { --- 1026,1037 ---- | LOOKAHEAD( getField(null, null) ) ! overrides = getField(impl, fields, overrides, storeDocString) ! | { Definition m; Token t = getToken(1); } [ "public" | "private" ] ( LOOKAHEAD( methodBodyDefinitionLookahead() ) ! m = methodBodyDefinition(impl) ! { globalDefinitions.add(m); } | m = internalMethodOrFunction(res) { *************** *** 1038,1042 **** //globalDefinitions.add(m); } ! ) )* "}" --- 1041,1048 ---- //globalDefinitions.add(m); } ! ) ! { if (storeDocString && t.specialToken != null && t.specialToken.kind == FORMAL_COMMENT) ! m.docString = t.specialToken.image; ! } )* "}" *************** *** 1468,1472 **** ! Definition definition(List definitions): { Definition res; } { --- 1474,1478 ---- ! Definition definition(List definitions, boolean storeDocString): { Definition res; } { *************** *** 1485,1489 **** LOOKAHEAD ( "abstract" "interface" ) res=interfaceDefinition(cst) ! | res=classDefinition(cst, definitions) | res=methodDeclaration(cst) ) --- 1491,1495 ---- LOOKAHEAD ( "abstract" "interface" ) res=interfaceDefinition(cst) ! | res=classDefinition(cst, definitions, storeDocString) | res=methodDeclaration(cst) ) *************** *** 1493,1503 **** } ! void readDefinitions(List definitions): { Definition d; globalDefinitions = definitions; } ! { ! ( d = definition(definitions) { definitions.add(d); } )* <EOF> } --- 1499,1518 ---- } ! void readDefinitions(List definitions,boolean storeDocString): { Definition d; globalDefinitions = definitions; + Token t; } ! { { t = getToken(1); } ! ( d = definition(definitions, storeDocString) ! { ! if (storeDocString && t.specialToken != null && t.specialToken.kind == FORMAL_COMMENT) ! d.docString = t.specialToken.image; ! ! definitions.add(d); ! t = getToken(1); ! } ! )* <EOF> } *************** *** 1782,1790 **** ****************************************************************/ ! void module(List definitions): {} { readOpens() ! readDefinitions(definitions) } --- 1797,1805 ---- ****************************************************************/ ! void module(List definitions, boolean storeDocStrings): {} { readOpens() ! readDefinitions(definitions, storeDocStrings) } Index: Loader.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Loader.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Loader.java 2 Dec 2003 00:03:03 -0000 1.21 --- Loader.java 4 Dec 2003 13:34:28 -0000 1.22 *************** *** 71,76 **** ParserTokenManager.nestingLevel = 0; try{ ! parser.module(definitions); } catch(ParseException e){ --- 71,78 ---- ParserTokenManager.nestingLevel = 0; + boolean storeDocStrings = false; + try{ ! parser.module(definitions, storeDocStrings); } catch(ParseException e){ |
From: <ar...@us...> - 2003-12-04 13:34:31
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv9889/F:/nice/src/bossa/syntax Modified Files: Definition.java NiceClass.java Log Message: Make it possible to store nicedoc strings in the ast. Index: Definition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Definition.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Definition.java 7 Nov 2003 21:53:00 -0000 1.20 --- Definition.java 4 Dec 2003 13:34:28 -0000 1.21 *************** *** 104,106 **** --- 104,108 ---- LocatedString name; + + public String docString; } Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** NiceClass.java 27 Nov 2003 14:57:56 -0000 1.73 --- NiceClass.java 4 Dec 2003 13:34:28 -0000 1.74 *************** *** 101,110 **** public Field makeField (MonoSymbol sym, Expression value, ! boolean isFinal, boolean isTransient, boolean isVolatile) { if (definition instanceof ClassDefinition.Interface) User.error(sym, "An interface cannot have a field."); ! return new NewField(sym, value, isFinal, isTransient, isVolatile); } --- 101,110 ---- public Field makeField (MonoSymbol sym, Expression value, ! boolean isFinal, boolean isTransient, boolean isVolatile, String docString) { if (definition instanceof ClassDefinition.Interface) User.error(sym, "An interface cannot have a field."); ! return new NewField(sym, value, isFinal, isTransient, isVolatile, docString); } *************** *** 189,192 **** --- 189,193 ---- NiceFieldAccess method; + } *************** *** 194,198 **** { private NewField(MonoSymbol sym, Expression value, ! boolean isFinal, boolean isTransient, boolean isVolatile) { super(sym, value); --- 195,200 ---- { private NewField(MonoSymbol sym, Expression value, ! boolean isFinal, boolean isTransient, boolean isVolatile, ! String docString) { super(sym, value); *************** *** 200,203 **** --- 202,206 ---- this.isTransient = isTransient; this.isVolatile = isVolatile; + this.docString = docString; if (isFinal && isVolatile) *************** *** 275,278 **** --- 278,283 ---- boolean isTransient; boolean isVolatile; + + public String docString; } |
From: <bo...@us...> - 2003-12-04 13:06:43
|
Update of /cvsroot/nice/Nice/src/mlsub/typing In directory sc8-pr-cvs1:/tmp/cvs-serv4559/src/mlsub/typing Added Files: TopMonotype.java Log Message: Made Object a super-type of every monotype. --- NEW FILE: TopMonotype.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2003 */ /* */ /* 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 mlsub.typing; import mlsub.typing.lowlevel.Kind; import mlsub.typing.lowlevel.Element; /** A monotype greater than all others. @author Daniel Bonniot (bo...@us...) */ public class TopMonotype extends Monotype implements TypeSymbol { private TopMonotype() {} public static final TopMonotype instance = new TopMonotype(); public TypeSymbol cloneTypeSymbol() { return this; } Monotype canonify() { return this; } Monotype substitute(java.util.Map map) { return this; } void tag(int variance) {} public String toString() { return "Object"; } /**************************************************************** * low-level interface ****************************************************************/ public int getId() { throw new Error(); } public void setId(int value) { throw new Error(); } public Kind getKind() { return TopKind.instance; } public void setKind(Kind value) { throw new Error(); } /**************************************************************** * The Top kind ****************************************************************/ public static class TopKind implements Kind { private TopKind() {} public static final TopKind instance = new TopKind(); public void leq(Element e1, Element e2, boolean initial) { // Nothing to do. } public void leq(Element e1, Element e2) { // Nothing to do. } public void register(Element e) { // Nothing to do. } public Monotype freshMonotype() { return null; } } } |
From: <bo...@us...> - 2003-12-03 21:50:45
|
Update of /cvsroot/nice/Nice/regtest/java/J In directory sc8-pr-cvs1:/tmp/cvs-serv1807/regtest/java/J Modified Files: J.java Log Message: Made Object a super-type of every monotype. Index: J.java =================================================================== RCS file: /cvsroot/nice/Nice/regtest/java/J/J.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** J.java 28 Nov 2003 14:01:30 -0000 1.1 --- J.java 3 Dec 2003 21:50:41 -0000 1.2 *************** *** 2,5 **** --- 2,7 ---- public class J { + Object obj; + void jMethod(Other o) {} } |
From: <bo...@us...> - 2003-12-03 21:50:45
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv1807/src/bossa/syntax Modified Files: TypeIdent.java GlobalTypeScope.java ClassExp.java Log Message: Made Object a super-type of every monotype. Index: TypeIdent.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeIdent.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TypeIdent.java 9 Jul 2003 23:03:20 -0000 1.24 --- TypeIdent.java 3 Dec 2003 21:50:41 -0000 1.25 *************** *** 79,87 **** TypeSymbol res = resolveToTypeSymbol(scope); ! if (res instanceof MonotypeVar) ! { ! MonotypeVar v = (MonotypeVar) res; ! return v; ! } if (res instanceof TypeConstructor) --- 79,84 ---- TypeSymbol res = resolveToTypeSymbol(scope); ! if (res instanceof mlsub.typing.Monotype) ! return (mlsub.typing.Monotype) res; if (res instanceof TypeConstructor) Index: GlobalTypeScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalTypeScope.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GlobalTypeScope.java 22 Mar 2003 12:43:21 -0000 1.6 --- GlobalTypeScope.java 3 Dec 2003 21:50:41 -0000 1.7 *************** *** 31,34 **** --- 31,38 ---- super(null); set = new HashSet(); + + try { + addMapping("java.lang.Object", mlsub.typing.TopMonotype.instance); + } catch (DuplicateName ex) {} } Index: ClassExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassExp.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ClassExp.java 24 Jun 2003 15:28:19 -0000 1.11 --- ClassExp.java 3 Dec 2003 21:50:41 -0000 1.12 *************** *** 65,70 **** fullName = root.name.append(".").append(fullName).toString(); ! mlsub.typing.TypeConstructor tc = (mlsub.typing.TypeConstructor) ! Node.getGlobalTypeScope().lookup(fullName, name.location()); if(tc != null) --- 65,70 ---- fullName = root.name.append(".").append(fullName).toString(); ! mlsub.typing.TypeConstructor tc = ! Node.getGlobalTypeScope().globalLookup(fullName, name.location()); if(tc != null) |
From: <bo...@us...> - 2003-12-03 21:50:45
|
Update of /cvsroot/nice/Nice/regtest/java In directory sc8-pr-cvs1:/tmp/cvs-serv1807/regtest/java Added Files: object.nice Log Message: Made Object a super-type of every monotype. --- NEW FILE: object.nice --- package regtest.java; void testObject(regtest.java.J.J j) { ?Object o = j.obj; } |