nice-commit Mailing List for The Nice Programming Language (Page 92)
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: <ar...@us...> - 2003-07-31 19:56:09
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv25581/F:/nice/testsuite/compiler/classes Modified Files: field-override.testsuite Log Message: Testcase for bug in compiling field override. Index: field-override.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/field-override.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** field-override.testsuite 31 Jul 2003 18:45:35 -0000 1.1 --- field-override.testsuite 31 Jul 2003 19:56:05 -0000 1.2 *************** *** 156,157 **** --- 156,166 ---- override LinkedList<String> names = new LinkedList(); } + + /// PASS bug + /// Toplevel + class A { + final ?String s; + } + class B extends A { + override String s = "abc"; + } |
From: <bo...@us...> - 2003-07-31 19:32:11
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv22002/src/bossa/syntax Modified Files: analyse.nice VarSymbol.java JavaFieldAccess.java FieldAccess.java Log Message: Allow again to refer to unqualified static java fields. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** analyse.nice 28 Jul 2003 18:06:19 -0000 1.77 --- analyse.nice 31 Jul 2003 19:32:05 -0000 1.78 *************** *** 442,446 **** } ! if (sym.isFieldAccess() && Node.thisExp != null) { CallExp res = new CallExp --- 442,446 ---- } ! if (sym.isNonStaticFieldAccess() && Node.thisExp != null) { CallExp res = new CallExp *************** *** 450,453 **** --- 450,463 ---- return res; } + else if (sym.isStaticFieldAccess()) + // Refering to an unqualified static field. + { + // Make an implicit call to fetch the static field's value. + CallExp res = new CallExp + (newOverloadedSymbolExp(symbols, e.ident), + Arguments.noArguments()); + res.setLocation(e.location()); + return res; + } return new SymbolExp(sym, e.location()); } Index: VarSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarSymbol.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** VarSymbol.java 26 Jul 2003 22:29:47 -0000 1.33 --- VarSymbol.java 31 Jul 2003 19:32:05 -0000 1.34 *************** *** 49,52 **** --- 49,64 ---- } + final boolean isNonStaticFieldAccess() + { + FieldAccess access = getFieldAccessMethod(); + return access != null && ! access.isStatic(); + } + + final boolean isStaticFieldAccess() + { + FieldAccess access = getFieldAccessMethod(); + return access != null && access.isStatic(); + } + FieldAccess getFieldAccessMethod() { Index: JavaFieldAccess.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/JavaFieldAccess.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** JavaFieldAccess.java 31 Jul 2003 18:45:35 -0000 1.15 --- JavaFieldAccess.java 31 Jul 2003 19:32:05 -0000 1.16 *************** *** 83,86 **** --- 83,87 ---- public boolean isFinal() { return field.isFinal(); } + public boolean isStatic() { return field.isStatic(); } void buildScope(VarScope outer, TypeScope typeOuter) Index: FieldAccess.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FieldAccess.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FieldAccess.java 31 Jul 2003 18:45:35 -0000 1.12 --- FieldAccess.java 31 Jul 2003 19:32:05 -0000 1.13 *************** *** 52,55 **** --- 52,56 ---- public abstract boolean isFinal(); + public boolean isStatic() { return false; } /**************************************************************** |
From: <bo...@us...> - 2003-07-31 19:32:08
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1:/tmp/cvs-serv22002/testsuite/compiler/native Modified Files: fields.testsuite Log Message: Allow again to refer to unqualified static java fields. Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/native/fields.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fields.testsuite 24 Jan 2003 19:08:38 -0000 1.1 --- fields.testsuite 31 Jul 2003 19:32:05 -0000 1.2 *************** *** 5,7 **** java.io.PrintStream s = id(System.out); /// Toplevel ! <T> T id(T x) = x; \ No newline at end of file --- 5,19 ---- java.io.PrintStream s = id(System.out); /// Toplevel ! <T> T id(T x) = x; ! ! /// PASS ! /// Toplevel ! import javax.swing.*; ! ! class J extends javax.swing.JPanel ! { ! void foo() ! { ! let i = WHEN_IN_FOCUSED_WINDOW; ! } ! } |
From: <bo...@us...> - 2003-07-31 19:32:08
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv22002/src/gnu/bytecode Modified Files: Field.java Log Message: Allow again to refer to unqualified static java fields. Index: Field.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/Field.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Field.java 11 Jun 2003 19:53:06 -0000 1.5 --- Field.java 31 Jul 2003 19:32:05 -0000 1.6 *************** *** 51,55 **** } ! public final boolean isFinal() { return (flags & Access.FINAL) != 0; } public final int getFlags() { --- 51,56 ---- } ! public final boolean isFinal() { return (flags & Access.FINAL) != 0; } ! public final boolean isStatic() { return (flags & Access.STATIC) != 0; } public final int getFlags() { |
From: <bo...@us...> - 2003-07-31 18:45:39
|
Update of /cvsroot/nice/Nice/lib/emacs In directory sc8-pr-cvs1:/tmp/cvs-serv14144/lib/emacs Modified Files: nice-mode.el Log Message: Added field overriding. Index: nice-mode.el =================================================================== RCS file: /cvsroot/nice/Nice/lib/emacs/nice-mode.el,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** nice-mode.el 28 Apr 2003 23:56:00 -0000 1.30 --- nice-mode.el 31 Jul 2003 18:45:35 -0000 1.31 *************** *** 196,200 **** ;; Keywords ! '("\\<\\(fun\\|static\\|final\\|transient\\|volatile\\|const\\|let\\|extends\\|implements\\|abstract\\|public\\|private\\|var\\|class\\|interface\\|new\\|else\\|native\\|inline\\|import\\|package\\|alike\\|Any\\|return\\|break\\|continue\\|super\\|try\\|catch\\|finally\\|throw\\|instanceof\\|requires\\|ensures\\|assert\\|do\\)\\>\\|@\\|=>" 0 nice-keyword-face) --- 196,200 ---- ;; Keywords ! '("\\<\\(fun\\|static\\|final\\|transient\\|volatile\\|const\\|let\\|extends\\|implements\\|abstract\\|public\\|private\\|var\\|class\\|interface\\|override\\|new\\|else\\|native\\|inline\\|import\\|package\\|alike\\|Any\\|return\\|break\\|continue\\|super\\|try\\|catch\\|finally\\|throw\\|instanceof\\|requires\\|ensures\\|assert\\|do\\)\\>\\|@\\|=>" 0 nice-keyword-face) |
From: <bo...@us...> - 2003-07-31 18:45:39
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv14144/debian Modified Files: changelog Log Message: Added field overriding. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.191 retrieving revision 1.192 diff -C2 -d -r1.191 -r1.192 *** changelog 18 Jul 2003 22:56:50 -0000 1.191 --- changelog 31 Jul 2003 18:45:35 -0000 1.192 *************** *** 1,5 **** nice (0.9.1) unstable; urgency=low ! * A class can now initializers, which are executed each time an instance is created. class A --- 1,16 ---- nice (0.9.1) unstable; urgency=low ! * Final fields can be overriden in sub-classes, with a more precise type ! and a different default value. In particular, this removes the need for ! a cast when reading the field's value from an instance of the sub-class. ! class A ! { ! final List<String> names; ! } ! class B extends A ! { ! override LinkedList<String> names; ! } ! * A class can now have initializers, which are executed each time an instance is created. class A |
From: <bo...@us...> - 2003-07-31 18:45:38
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv14144/src/bossa/parser Modified Files: Parser.jj Log Message: Added field overriding. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.201 retrieving revision 1.202 diff -C2 -d -r1.201 -r1.202 *** Parser.jj 27 Jul 2003 13:14:44 -0000 1.201 --- Parser.jj 31 Jul 2003 18:45:35 -0000 1.202 *************** *** 149,152 **** --- 149,153 ---- | < EXTENDS: "extends" > | < ENUM: "enum" > + | < OVERRIDE: "override" > // Packages *************** *** 895,906 **** } ! void getField(NiceClass c, List fields): { MonoSymbol field; boolean isFinal=false, isTransient = false, isVolatile = false; Expression value = null; Token t = null; } { ( "public-read" [ "private-write" ] --- 896,911 ---- } ! List getField(NiceClass c, List fields, List overrides): { MonoSymbol field; boolean isFinal=false, isTransient = false, isVolatile = false; + boolean isOverride = false; Expression value = null; Token t = null; } { + ( + "override" { isOverride = true; } + | ( "public-read" [ "private-write" ] *************** *** 912,919 **** [ "transient" { isTransient = true; } ] [ "volatile" { isVolatile = true; } ] field=monoSymbol() [ "=" value=Expression() ] ";" ! { fields.add(c.makeField(field, value, isFinal, isTransient, isVolatile)); } } --- 917,936 ---- [ "transient" { isTransient = true; } ] [ "volatile" { isVolatile = true; } ] + ) field=monoSymbol() [ "=" value=Expression() ] ";" ! { ! if (isOverride) ! { ! if (overrides == null) ! overrides = new LinkedList(); ! overrides.add(c.makeOverride(field, value)); ! } ! else ! fields.add(c.makeField(field, value, isFinal, isTransient, isVolatile)); ! ! return overrides; ! } } *************** *** 963,967 **** { NiceClass impl = new NiceClass(res); } // internal fields and methods ! { List fields = new ArrayList(), methods = null, initializers = null; } ( // Initializer --- 980,985 ---- { NiceClass impl = new NiceClass(res); } // internal fields and methods ! { List fields = new LinkedList(), overrides = null, ! methods = null, initializers = null; } ( // Initializer *************** *** 975,979 **** | LOOKAHEAD( getField(null, null) ) ! getField(impl, fields) | [ "public" | "private" ] --- 993,997 ---- | LOOKAHEAD( getField(null, null) ) ! overrides = getField(impl, fields, overrides) | [ "public" | "private" ] *************** *** 997,1000 **** --- 1015,1019 ---- { impl.setFields(fields); + impl.setOverrides(overrides); if (initializers != null) impl.setInitializers(initializers); |
From: <bo...@us...> - 2003-07-31 18:45:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv14144/src/bossa/syntax Modified Files: NiceFieldAccess.java NiceClass.java JavaFieldAccess.java IncrementExp.java FormalParameters.java FieldAccess.java EnumDefinition.java CallExp.java Log Message: Added field overriding. Index: NiceFieldAccess.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceFieldAccess.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NiceFieldAccess.java 28 Jul 2003 21:45:52 -0000 1.16 --- NiceFieldAccess.java 31 Jul 2003 18:45:35 -0000 1.17 *************** *** 50,53 **** --- 50,55 ---- } + public boolean isFinal() { return field.isFinal(); } + final NiceClass.Field field; Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** NiceClass.java 28 Jul 2003 21:45:52 -0000 1.54 --- NiceClass.java 31 Jul 2003 18:45:35 -0000 1.55 *************** *** 49,65 **** this.fields = noFields; else ! { ! this.fields = (Field[]) fields.toArray(new Field[fields.size()]); ! ! //do not enter fields into global scope ! for (int i = 0; i < this.fields.length; i++) ! this.fields[i].sym.propagate = Node.none; ! for (int i = 0; i < this.fields.length; i++) ! { ! NiceFieldAccess f = new NiceFieldAccess(this, this.fields[i]); ! this.fields[i].method = f; ! definition.addChild(f); ! } } } --- 49,63 ---- this.fields = noFields; else ! this.fields = (NewField[]) fields.toArray(new NewField[fields.size()]); ! } ! public void setOverrides(List overrides) ! { ! if (overrides == null || overrides.size() == 0) ! this.overrides = noOverrides; ! else ! { ! this.overrides = (OverridenField[]) ! overrides.toArray(new OverridenField[overrides.size()]); } } *************** *** 67,72 **** ClassDefinition definition; ! private static Field[] noFields = new Field[0]; /**************************************************************** * Fields --- 65,81 ---- ClassDefinition definition; ! private static NewField[] noFields = new NewField[0]; ! private static OverridenField[] noOverrides = new OverridenField[0]; + NiceClass getParent() + { + TypeConstructor tc = definition.getSuperClass(); + ClassDefinition sup = ClassDefinition.get(tc); + if (sup != null && sup.implementation instanceof NiceClass) + return ((NiceClass) sup.implementation); + else + return null; + } + /**************************************************************** * Fields *************** *** 79,100 **** if (definition instanceof ClassDefinition.Interface) User.error(sym, "An interface cannot have a field."); ! return new Field(sym, value, isFinal, isTransient, isVolatile); } ! public class Field { ! public Field(MonoSymbol sym, Expression value, ! boolean isFinal, boolean isTransient, boolean isVolatile) { this.sym = sym; this.value = value; - this.isFinal = isFinal; - this.isTransient = isTransient; - this.isVolatile = isVolatile; ! if (isFinal && isVolatile) ! throw User.error(sym, "A field cannot be final and volatile"); } void resolve(VarScope scope, TypeScope typeScope) { --- 88,124 ---- if (definition instanceof ClassDefinition.Interface) User.error(sym, "An interface cannot have a field."); ! ! return new NewField(sym, value, isFinal, isTransient, isVolatile); } ! public Field makeOverride (MonoSymbol sym, Expression value) { ! if (definition instanceof ClassDefinition.Interface) ! User.error(sym, "An interface cannot have a field."); ! ! return new OverridenField(sym, value); ! } ! ! abstract class Field ! { ! private Field(MonoSymbol sym, Expression value) { this.sym = sym; this.value = value; ! // Do not enter fields into global scope. ! sym.propagate = Node.none; ! ! method = new NiceFieldAccess(NiceClass.this, this); ! NiceClass.this.definition.addChild(method); } + NiceClass getDeclaringClass() + { + return NiceClass.this; + } + + abstract boolean isFinal(); + void resolve(VarScope scope, TypeScope typeScope) { *************** *** 107,123 **** } ! void createField() { ! method.fieldDecl = classe.addField ! (sym.name.toString(), Types.javaType(sym.type)); ! method.fieldDecl.setFlag(isTransient, gnu.expr.Declaration.TRANSIENT); ! method.fieldDecl.setFlag(isVolatile , gnu.expr.Declaration.VOLATILE); } ! void typecheck(NiceClass c) { if (value != null) { ! c.enterTypingContext(); mlsub.typing.Polytype declaredType = sym.getType(); --- 131,149 ---- } ! FormalParameters.Parameter asParameter(TypeMap map) { ! Monotype type = Monotype.create(sym.syntacticType.resolve(map)); ! if (value == null) ! return new FormalParameters.NamedParameter(type, sym.getName(), true); ! else ! return new FormalParameters.OptionalParameter ! (type, sym.getName(), true, value); } ! void typecheck() { if (value != null) { ! NiceClass.this.enterTypingContext(); mlsub.typing.Polytype declaredType = sym.getType(); *************** *** 139,171 **** { return - (isFinal ? "final " : "") + sym + (value == null ? "" : " = " + value); } ! FormalParameters.Parameter asParameter(TypeMap map) { ! Monotype type = Monotype.create(sym.syntacticType.resolve(map)); ! if (value == null) ! return new FormalParameters.NamedParameter(type, sym.getName(), true); ! else ! return new FormalParameters.OptionalParameter ! (type, sym.getName(), true, value); } ! NiceClass getDeclaringClass() { ! return NiceClass.this; } ! MonoSymbol sym; ! Expression value; boolean isFinal; boolean isTransient; boolean isVolatile; ! NiceFieldAccess method; } ! ! // Used to resolve fields, and constructor cosntraint. private TypeScope localScope; --- 165,324 ---- { return sym + (value == null ? "" : " = " + value); } ! MonoSymbol sym; ! Expression value; ! ! NiceFieldAccess method; ! } ! ! final class NewField extends Field ! { ! private NewField(MonoSymbol sym, Expression value, ! boolean isFinal, boolean isTransient, boolean isVolatile) { ! super(sym, value); ! this.isFinal = isFinal; ! this.isTransient = isTransient; ! this.isVolatile = isVolatile; ! ! if (isFinal && isVolatile) ! throw User.error(sym, "A field cannot be final and volatile"); } ! boolean isFinal() { return isFinal; } ! ! void createField() { ! method.fieldDecl = classe.addField ! (sym.name.toString(), Types.javaType(sym.type)); ! method.fieldDecl.setFlag(isTransient, gnu.expr.Declaration.TRANSIENT); ! method.fieldDecl.setFlag(isVolatile , gnu.expr.Declaration.VOLATILE); } ! void checkNoDuplicate(FormalParameters.Parameter[] fields, ! int rankInThisClass) ! { ! /* ! We check that there is no duplicate in all the inherited fields, ! but also in the fields of this class stricly before this one. ! */ ! int max = fields.length - NiceClass.this.fields.length + rankInThisClass; ! String name = sym.getName().toString(); ! for (int i = 0; i < max; i++) ! { ! if (fields[i].match(name)) ! User.error(sym, ! (max - i >= NiceClass.this.fields.length) ! ? "A field with the same name exists in a super-class" ! : "A field with the same name exists in this class"); ! } ! } ! ! public String toString() ! { ! return ! (isFinal ? "final " : "") + ! super.toString(); ! } ! boolean isFinal; boolean isTransient; boolean isVolatile; + } ! final class OverridenField extends Field ! { ! private OverridenField(MonoSymbol sym, Expression value) ! { ! super(sym, value); ! } ! ! boolean isFinal() { return true; } ! ! /** ! Update the type and default values for the constructor, according ! to this overriding. ! */ ! void updateConstructorParameter ! (FormalParameters.Parameter[] inherited, int nb, TypeScope scope) ! { ! String name = sym.getName().toString(); ! Monotype type = Monotype.create(sym.syntacticType.resolve(scope)); ! ! for (int i = 0; i < nb; i++) ! if (inherited[i].match(name)) ! { ! if (value != null) ! inherited[i] = asParameter(scope); ! else ! inherited[i].resetType(type); ! } ! } ! ! void typecheck() ! { ! gnu.expr.Declaration decl = null; ! ! NiceClass parent = getParent(); ! if (parent != null) ! decl = parent.getOverridenField(this, value == null); ! ! if (decl == null) ! throw User.error(sym, ! "No field with this name exists in a super-class"); ! ! method.fieldDecl = decl; ! ! super.typecheck(); ! } ! ! /** ! @param checkValue ! Whether to check that the original field's value, if it exists, ! must be checked against the overriden type. ! @return the checkValue to be used for other versions of this field ! higher up in the hierarchy. ! */ ! boolean checkOverride(Field original, boolean checkValue) ! { ! NiceClass.this.enterTypingContext(); ! ! mlsub.typing.Monotype originalType = original.sym.syntacticType.resolve ! (original.getDeclaringClass().translationScope(NiceClass.this)); ! ! try { ! Typing.leq(this.sym.type, originalType); ! } ! catch (TypingEx ex) { ! User.error(this.sym, ! "The new type must be a subtype of the original type declared in " + original.getDeclaringClass() + ".\n" + ! "Original type: " + originalType); ! } ! ! if (checkValue && original.value != null) ! { ! try { ! Typing.leq(original.value.getType(), this.sym.getType()); ! } ! catch (mlsub.typing.TypingEx ex) { ! User.error(sym, "The default value declared in " + ! original.getDeclaringClass() + ! "\nis not compatible with the overriden type"); ! } ! return false; ! } ! ! return checkValue; ! } ! ! public String toString() ! { ! return "override " + super.toString(); ! } } ! ! // Used to resolve fields, and constructor constraint. private TypeScope localScope; *************** *** 182,190 **** private void resolveFields() { - if (fields.length == 0) - return; - for (int i = 0; i < fields.length; i++) fields[i].resolve(definition.scope, localScope); } --- 335,343 ---- private void resolveFields() { for (int i = 0; i < fields.length; i++) fields[i].resolve(definition.scope, localScope); + + for (int i = 0; i < overrides.length; i++) + overrides[i].resolve(definition.scope, localScope); } *************** *** 195,198 **** --- 348,379 ---- } + private gnu.expr.Declaration getOverridenField + (OverridenField field, boolean checkValue) + { + String name = field.sym.getName().toString(); + + for (int i = 0; i < fields.length; i++) + if (fields[i].sym.getName().toString().equals(name)) + { + if (! fields[i].isFinal) + User.error(field.sym, "The original field in class " + this + + " is not final, so its type cannot be overriden"); + + checkValue = field.checkOverride(fields[i], checkValue); + + return fields[i].method.fieldDecl; + } + + for (int i = 0; i < overrides.length; i++) + if (overrides[i].sym.getName().toString().equals(name)) + checkValue = field.checkOverride(overrides[i], checkValue); + + NiceClass parent = getParent(); + if (parent != null) + return parent.getOverridenField(field, checkValue); + else + return null; + } + /**************************************************************** * Initializers *************** *** 259,263 **** try { for (int i = 0; i < fields.length; i++) ! fields[i].typecheck(this); if (initializers.length != 0) --- 440,447 ---- try { for (int i = 0; i < fields.length; i++) ! fields[i].typecheck(); ! ! for (int i = 0; i < overrides.length; i++) ! overrides[i].typecheck(); if (initializers.length != 0) *************** *** 382,385 **** --- 566,590 ---- } + /** + @return the scope that maps the type parameters of the other class + to the corresponding symbol in the constructor of this class. + */ + private TypeScope translationScope(NiceClass other) + { + mlsub.typing.MonotypeVar[] typeParams = other.definition.getTypeParameters(); + TypeScope scope = Node.getGlobalTypeScope(); + Map map = null; + if (typeParams != null) + { + scope = new TypeScope(scope); + for (int i = 0; i < typeParams.length; i++) + try { + scope.addMapping(definition.classConstraint.typeParameters[i].getName(), typeParams[i]); + } catch(TypeScope.DuplicateName e) {} + } + + return scope; + } + private FormalParameters.Parameter[][] getFieldsAsParameters (int nbFields, List constraints, MonotypeVar[] typeParams) *************** *** 389,393 **** (definition.getSuperClass(), nbFields, constraints, typeParams); ! if (fields.length == 0 && definition.classConstraint == null) return res; --- 594,599 ---- (definition.getSuperClass(), nbFields, constraints, typeParams); ! if (fields.length == 0 && overrides.length == 0 && ! definition.classConstraint == null) return res; *************** *** 407,410 **** --- 613,618 ---- } + updateConstructorParameters(res[0], res[0].length - nbFields, scope); + for (int j = 0; j < res.length; j++) for (int i = fields.length, n = res[j].length - nbFields + i; --i >= 0;) *************** *** 424,427 **** --- 632,656 ---- } + /** + This must be done in a given class for every subclass, since they + have different type parameters. + */ + private void updateConstructorParameters + (FormalParameters.Parameter[] inherited, int nb, TypeScope scope) + { + for (int f = 0; f < overrides.length; f++) + overrides[f].updateConstructorParameter(inherited, nb, scope); + } + + /** + This must be done only once per class. + */ + private void checkFields (FormalParameters.Parameter[] allFields) + { + int len = allFields.length; + for (int f = 0; f < fields.length; f++) + fields[f].checkNoDuplicate(allFields, f); + } + private Constructor[] constructorMethod; *************** *** 441,444 **** --- 670,675 ---- getFieldsAsParameters(0, constraints, typeParams); + checkFields(params[0]); + Constraint cst; if (typeParams != null) *************** *** 608,611 **** public String toString() { return definition.toString(); } ! private Field[] fields; } --- 839,843 ---- public String toString() { return definition.toString(); } ! private NewField[] fields; ! private OverridenField[] overrides; } Index: JavaFieldAccess.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/JavaFieldAccess.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** JavaFieldAccess.java 24 Jul 2003 21:26:20 -0000 1.14 --- JavaFieldAccess.java 31 Jul 2003 18:45:35 -0000 1.15 *************** *** 41,53 **** } ! private JavaFieldAccess(LocatedString className,String fieldName, ! LocatedString name, ! mlsub.typing.Constraint cst, ! mlsub.typing.Monotype returnType, mlsub.typing.Monotype[] parameters) { ! super(name, cst, parameters, returnType); ! this.className = className; ! this.fieldName = fieldName; } --- 41,56 ---- } ! private JavaFieldAccess(Field field, mlsub.typing.Monotype[] parameters) + throws Types.ParametricClassException, Types.NotIntroducedClassException { ! super(new LocatedString(field.getName(), Location.nowhere()), ! null, parameters, ! Types.monotype(field.getType(), /* sure: */ field.isFinal())); ! this.field = field; ! this.className = new LocatedString(field.getDeclaringClass().getName(), ! Location.nowhere()); ! this.fieldName = field.getName(); ! this.fieldDecl = new Declaration(fieldName, field); } *************** *** 64,78 **** params = null; ! JavaFieldAccess res = new JavaFieldAccess ! (new LocatedString(f.getDeclaringClass().getName(), ! Location.nowhere()), ! f.getName(), ! new LocatedString(f.getName(), Location.nowhere()), ! null, ! Types.monotype(f.getType(), /* sure: */ f.isFinal()), ! params); ! ! res.field = f; ! res.fieldDecl = new Declaration(f.getName(), f); if (Debug.javaTypes) --- 67,71 ---- params = null; ! JavaFieldAccess res = new JavaFieldAccess(f, params); if (Debug.javaTypes) *************** *** 89,92 **** --- 82,87 ---- } + public boolean isFinal() { return field.isFinal(); } + void buildScope(VarScope outer, TypeScope typeOuter) { Index: IncrementExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/IncrementExp.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** IncrementExp.java 2 Feb 2002 12:21:47 -0000 1.15 --- IncrementExp.java 31 Jul 2003 18:45:35 -0000 1.16 *************** *** 66,69 **** --- 66,72 ---- "so it should be a call to a FieldAccessMethod"); + if (access.isFinal()) + User.error(this, "Field " + access + " is final"); + return Inline.inline (new IncrementProc(access.fieldDecl, returnOld, increment), Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** FormalParameters.java 26 Jul 2003 22:02:01 -0000 1.28 --- FormalParameters.java 31 Jul 2003 18:45:35 -0000 1.29 *************** *** 65,68 **** --- 65,75 ---- LocatedString getName() { return null; } + void resetType(Monotype type) + { + this.type = type; + if (symbol != null) + symbol.syntacticType = type; + } + Symbol getSymbol() { Index: FieldAccess.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FieldAccess.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FieldAccess.java 2 Sep 2002 11:46:51 -0000 1.11 --- FieldAccess.java 31 Jul 2003 18:45:35 -0000 1.12 *************** *** 51,54 **** --- 51,56 ---- public boolean isFieldAccess() { return true; } + public abstract boolean isFinal(); + /**************************************************************** * Code generation Index: EnumDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/EnumDefinition.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EnumDefinition.java 28 Jul 2003 17:50:50 -0000 1.4 --- EnumDefinition.java 31 Jul 2003 18:45:35 -0000 1.5 *************** *** 36,39 **** --- 36,40 ---- NiceClass impl = new NiceClass(classDef); impl.setFields(null); + impl.setOverrides(null); classDef.setImplementation(impl); Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** CallExp.java 25 Jul 2003 16:13:10 -0000 1.82 --- CallExp.java 31 Jul 2003 18:45:35 -0000 1.83 *************** *** 301,305 **** resolveOverloading(); return function.getFieldAccessMethod(); ! } /**************************************************************** --- 301,305 ---- resolveOverloading(); return function.getFieldAccessMethod(); ! } /**************************************************************** *************** *** 343,346 **** --- 343,350 ---- FieldAccess access = function.getFieldAccessMethod(); + + if (access.isFinal()) + User.error(this, "Field " + access + " is final"); + switch (arguments.size()) { |
From: <bo...@us...> - 2003-07-31 18:45:38
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv14144/testsuite/compiler/classes Modified Files: fields.testsuite Added Files: field-override.testsuite Log Message: Added field overriding. --- NEW FILE: field-override.testsuite --- /// PASS /// Toplevel class A { final A x; } class B extends A { override B x; } /// FAIL /// Toplevel class A { A x; } class B extends A { override B x; } /// FAIL /// Toplevel class A { override A x; } /// FAIL /// Toplevel class A { A x; } class B extends A { override B dummy; } /// PASS /// Toplevel class A { final A x; } class B extends A { override B x; } B goo(B b) = new B(x: b).x; /// FAIL /// Toplevel class A { final A x; } class B extends A { override B x; } B goo(A a) = new B(x: a); /// FAIL /// Toplevel class A { final A x; } class B extends A { override String x; } /// FAIL /// Toplevel class A { final A x; } class B extends A { override C x; } class C extends B { override B x; } /// PASS /// Toplevel class A<T> { final List<T> x; } class B<T> extends A { override LinkedList<T> x; } /// FAIL /// Toplevel class A<T> { final List<String> x; } class B<T> extends A { override List<T> x; } /// FAIL /// Toplevel class A<T> { final List<T> x; } class B<T> extends A { override List<String> x; } /// FAIL /// Toplevel class A { final List<String> names = new ArrayList(); } class B extends A { override LinkedList<String> /* /// FAIL HERE */ names; } /// PASS LinkedList<String> l = new B().names; /// Toplevel class A { final List<String> names = new ArrayList(); } class B extends A { override LinkedList<String> names = new LinkedList(); } Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/fields.testsuite,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fields.testsuite 27 Jul 2003 23:37:36 -0000 1.10 --- fields.testsuite 31 Jul 2003 18:45:35 -0000 1.11 *************** *** 101,102 **** --- 101,117 ---- final Class[] classes = [Foo.class, Bar.class]; } + + /// FAIL + /// Toplevel + class A { int x; int x; } + + /// FAIL + /// Toplevel + class A { int x; } + class B extends A { int /* /// FAIL HERE */ x; } + class C extends B {} + + /// FAIL + /// Toplevel + class A { final int x = 1; } + int f(A a) = a.x++; |
From: <bo...@us...> - 2003-07-29 01:21:30
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv5056/stdlib/nice/getopt Modified Files: gnugetopt.nice getopt.nice Log Message: Syntactical improvements. Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gnugetopt.nice 28 Jul 2003 19:42:24 -0000 1.9 --- gnugetopt.nice 29 Jul 2003 00:22:07 -0000 1.10 *************** *** 28,60 **** let char undefinedOption = '\0'; ! public class Getopt { ! ! private final int REQUIRE_ORDER = 1; ! private final int PERMUTE = 2; ! private final int RETURN_IN_ORDER = 3; ! ! private ?String optarg = null; ! private String nextchar = ""; ! private boolean posixly_correct = System.getProperty("gnu.posixly_correct", null) != null; ! private boolean longopt_handled = false; ! private boolean endparse = false; ! private boolean opterr = true; ! private char optopt = '?'; ! private int optind = 0; ! private int longind = 0; ! private int first_nonopt = 1; ! private int last_nonopt = 1; ! private final int ordering = 2;//== PERMUTE ! ! private String progname; ! private String[] argv; ! private String optstring = " "; ! private LongOpt[] long_options; ! private boolean long_only = false; ! //public Getopt(String progname, String[] argv, String optstring, ! // LongOpt[] long_options, boolean long_only) ! public void initGetopt() { if (optstring.length() == 0) optstring = " "; --- 28,41 ---- let char undefinedOption = '\0'; ! private let int REQUIRE_ORDER = 1; ! private let int PERMUTE = 2; ! private let int RETURN_IN_ORDER = 3; ! private let boolean posixly_correct = System.getProperty("gnu.posixly_correct") != null; ! public Getopt makeGetopt(String progname, String[] argv, String optstring, ! LongOpt[] long_options, boolean long_only = false) { + int ordering = PERMUTE; + if (optstring.length() == 0) optstring = " "; *************** *** 65,69 **** ordering = RETURN_IN_ORDER; if (optstring.length() > 1) ! this.optstring = optstring.substring(1); } else if (optstring.charAt(0) == '+') --- 46,50 ---- ordering = RETURN_IN_ORDER; if (optstring.length() > 1) ! optstring = optstring.substring(1); } else if (optstring.charAt(0) == '+') *************** *** 71,75 **** ordering = REQUIRE_ORDER; if (optstring.length() > 1) ! this.optstring = optstring.substring(1); } else if (posixly_correct) --- 52,56 ---- ordering = REQUIRE_ORDER; if (optstring.length() > 1) ! optstring = optstring.substring(1); } else if (posixly_correct) *************** *** 77,81 **** --- 58,86 ---- ordering = REQUIRE_ORDER; } + + return new Getopt(progname: progname, argv: argv, optstring: optstring, + long_options: long_options, + ordering: ordering, long_only: long_only); } + + public class Getopt { + + private ?String optarg = null; + private String nextchar = ""; + private boolean longopt_handled = false; + private boolean endparse = false; + private boolean opterr = true; + private char optopt = '?'; + private int optind = 0; + private int longind = 0; + private int first_nonopt = 1; + private int last_nonopt = 1; + private final int ordering; + + private String progname; + private String[] argv; + private String optstring = " "; + private LongOpt[] long_options; + private boolean long_only = false; Index: getopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/getopt.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** getopt.nice 28 Jul 2003 19:42:24 -0000 1.20 --- getopt.nice 29 Jul 2003 00:22:07 -0000 1.21 *************** *** 45,51 **** for (int i = 0; i < longOpts.length; i++) longOpts[i] = longOptions.get(i); ! Getopt g = new Getopt(progname: progName, argv: args, optstring: shortOptions, long_options: elementsNotNull(longOpts)); - g.initGetopt(); // Parsing loop char c = g.getopt(); --- 45,51 ---- for (int i = 0; i < longOpts.length; i++) longOpts[i] = longOptions.get(i); ! Getopt g = makeGetopt(progname: progName, argv: args, ! optstring: shortOptions, long_options: elementsNotNull(longOpts)); // Parsing loop char c = g.getopt(); |
From: <bo...@us...> - 2003-07-29 00:38:30
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv7577/src/nice/tools/compiler Modified Files: native.nice Log Message: Use correct type for a read line. Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/native.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** native.nice 16 Jul 2003 14:07:59 -0000 1.4 --- native.nice 29 Jul 2003 00:38:25 -0000 1.5 *************** *** 51,55 **** let in = new BufferedReader(new InputStreamReader(p.getErrorStream())); try { ! for (String line = in.readLine(); line != null; line = in.readLine()) System.out.println(line); --- 51,55 ---- let in = new BufferedReader(new InputStreamReader(p.getErrorStream())); try { ! for (?String line = in.readLine(); line != null; line = in.readLine()) System.out.println(line); |
From: <ar...@us...> - 2003-07-28 21:54:30
|
Update of /cvsroot/nice/Nice/stdlib/nice/doc In directory sc8-pr-cvs1:/tmp/cvs-serv9737/F:/nice/stdlib/nice/doc Modified Files: commands.nice man.nice Log Message: Minor correction. Index: commands.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/commands.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** commands.nice 28 Jul 2003 19:42:24 -0000 1.3 --- commands.nice 28 Jul 2003 21:54:27 -0000 1.4 *************** *** 45,49 **** StringBuffer res = new StringBuffer("Usage: "); res.append(prg.name); ! res.append(" [OPTIONS]"); if (prg.arguments != null) res.append(' ').append(notNull(prg.arguments).toUpperCase()); --- 45,50 ---- StringBuffer res = new StringBuffer("Usage: "); res.append(prg.name); ! if (prg.options.length != 0) ! res.append(" [OPTIONS]"); if (prg.arguments != null) res.append(' ').append(notNull(prg.arguments).toUpperCase()); Index: man.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/man.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** man.nice 28 Jul 2003 19:42:24 -0000 1.7 --- man.nice 28 Jul 2003 21:54:27 -0000 1.8 *************** *** 64,68 **** StringBuffer res = new StringBuffer(); res.append(".B ").append(prg.name).append("\n\\&"); ! res.append("[options]"); if (prg.arguments != null) res.append(' ').append(prg.arguments); --- 64,69 ---- StringBuffer res = new StringBuffer(); res.append(".B ").append(prg.name).append("\n\\&"); ! if (prg.options.length != 0) ! res.append("[options]"); if (prg.arguments != null) res.append(' ').append(prg.arguments); |
From: <ar...@us...> - 2003-07-28 21:45:55
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8095/F:/nice/src/bossa/syntax Modified Files: NiceClass.java NiceFieldAccess.java Log Message: Improved how fieldaccess are printed in error messages. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** NiceClass.java 28 Jul 2003 10:51:35 -0000 1.53 --- NiceClass.java 28 Jul 2003 21:45:52 -0000 1.54 *************** *** 153,156 **** --- 153,161 ---- } + NiceClass getDeclaringClass() + { + return NiceClass.this; + } + MonoSymbol sym; Expression value; Index: NiceFieldAccess.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceFieldAccess.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NiceFieldAccess.java 26 Jul 2003 22:02:01 -0000 1.15 --- NiceFieldAccess.java 28 Jul 2003 21:45:52 -0000 1.16 *************** *** 76,80 **** public String toString() { ! return "Field access to " + field; } } --- 76,81 ---- public String toString() { ! return "" + field.sym.type + " " + ! field.getDeclaringClass().definition.name + "." + field.sym.name; } } |
From: <ar...@us...> - 2003-07-28 19:42:27
|
Update of /cvsroot/nice/Nice/stdlib/nice/doc In directory sc8-pr-cvs1:/tmp/cvs-serv11667/F:/nice/stdlib/nice/doc Modified Files: commands.nice man.nice Log Message: Added some retypings and reduced comparing with null warnings. Index: commands.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/commands.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** commands.nice 19 Apr 2002 12:18:11 -0000 1.2 --- commands.nice 28 Jul 2003 19:42:24 -0000 1.3 *************** *** 45,50 **** StringBuffer res = new StringBuffer("Usage: "); res.append(prg.name); ! if (prg.options != null) ! res.append(" [OPTIONS]"); if (prg.arguments != null) res.append(' ').append(notNull(prg.arguments).toUpperCase()); --- 45,49 ---- StringBuffer res = new StringBuffer("Usage: "); res.append(prg.name); ! res.append(" [OPTIONS]"); if (prg.arguments != null) res.append(' ').append(notNull(prg.arguments).toUpperCase()); Index: man.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/doc/man.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** man.nice 14 Jun 2003 08:37:13 -0000 1.6 --- man.nice 28 Jul 2003 19:42:24 -0000 1.7 *************** *** 64,69 **** StringBuffer res = new StringBuffer(); res.append(".B ").append(prg.name).append("\n\\&"); ! if (prg.options != null) ! res.append("[options]"); if (prg.arguments != null) res.append(' ').append(prg.arguments); --- 64,68 ---- StringBuffer res = new StringBuffer(); res.append(".B ").append(prg.name).append("\n\\&"); ! res.append("[options]"); if (prg.arguments != null) res.append(' ').append(prg.arguments); |
From: <ar...@us...> - 2003-07-28 19:42:27
|
Update of /cvsroot/nice/Nice/stdlib/nice/getopt In directory sc8-pr-cvs1:/tmp/cvs-serv11667/F:/nice/stdlib/nice/getopt Modified Files: getopt.nice gnugetopt.nice man.nice Log Message: Added some retypings and reduced comparing with null warnings. Index: getopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/getopt.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** getopt.nice 15 Jun 2003 11:52:17 -0000 1.19 --- getopt.nice 28 Jul 2003 19:42:24 -0000 1.20 *************** *** 25,43 **** options.foreach(Option o => { ! if(o.longName != null) ! { ! LongOpt l; ! if(o.noShortName) ! { ! uniqId = uniqId+1; ! l = new LongOpt(name:o.longName, has_arg:optType(o), val:char(uniqId)); ! } ! else ! l = new LongOpt(name:o.longName,has_arg:optType(o),val:o.shortName); ! l.initLongOpt(); ! o.optval = l.getVal(); ! ! longOptions.add(l); ! } if(!o.noShortName) --- 25,40 ---- options.foreach(Option o => { ! LongOpt l; ! if(o.noShortName) ! { ! uniqId = uniqId+1; ! l = new LongOpt(name:o.longName, has_arg:optType(o), val:char(uniqId)); ! } ! else ! l = new LongOpt(name:o.longName,has_arg:optType(o),val:o.shortName); ! l.initLongOpt(); ! o.optval = l.getVal(); ! ! longOptions.add(l); if(!o.noShortName) *************** *** 108,113 **** String res = opt.noShortName ? " " : (" -" + opt.shortName); ! if(opt.longName != null) ! res = res + (opt.noShortName ? " " : ",") + " --" + opt.longName; res += paramString(opt); --- 105,110 ---- String res = opt.noShortName ? " " : (" -" + opt.shortName); ! ! res = res + (opt.noShortName ? " " : ",") + " --" + opt.longName; res += paramString(opt); Index: gnugetopt.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/gnugetopt.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gnugetopt.nice 18 Jun 2003 21:30:30 -0000 1.8 --- gnugetopt.nice 28 Jul 2003 19:42:24 -0000 1.9 *************** *** 375,381 **** This distinction seems to be the most useful approach. */ ! if ((long_options != null) && (argv[optind].startsWith("--") ! || (long_only && ((argv[optind].length() > 2) || ! (optstring.indexOf(argv[optind].charAt(1)) == -1))))) { char c = this.checkLongOption(); --- 375,381 ---- This distinction seems to be the most useful approach. */ ! if (argv[optind].startsWith("--") || ! (long_only && ((argv[optind].length() > 2) || ! (optstring.indexOf(argv[optind].charAt(1)) == -1)))) { char c = this.checkLongOption(); Index: man.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/getopt/man.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** man.nice 24 Jan 2003 12:36:47 -0000 1.4 --- man.nice 28 Jul 2003 19:42:24 -0000 1.5 *************** *** 34,39 **** if (! opt.noShortName) res.append("\\-").append(opt.shortName); ! if(opt.longName != null) ! res.append((opt.noShortName ? "" : ", ") + "\\-\\-" + opt.longName); res.append(paramString(opt)); --- 34,39 ---- if (! opt.noShortName) res.append("\\-").append(opt.shortName); ! ! res.append((opt.noShortName ? "" : ", ") + "\\-\\-" + opt.longName); res.append(paramString(opt)); |
From: <ar...@us...> - 2003-07-28 19:42:27
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv11667/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: Added some retypings and reduced comparing with null warnings. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** java.nice 21 Jul 2003 17:24:14 -0000 1.25 --- java.nice 28 Jul 2003 19:42:23 -0000 1.26 *************** *** 59,62 **** --- 59,67 ---- java.util.Properties<String,String> getProperties() = native java.util.Properties java.lang.System.getProperties(); + ?String System_getProperty(String) = native String System.getProperty(String); + <T | T <: ?String> T System_getProperty(String,T) = + native String System.getProperty(String, String); + ?String System_setProperty(String,String) = + native String System.setProperty(String,String); // PACKAGE: java.text *************** *** 72,75 **** --- 77,83 ---- native void PrintStream.println(Object); String getAbsolutePath (File) = native String File.getAbsolutePath(); + + ?String readLine(BufferedReader) = native String BufferedReader.readLine(); + ?String readLine(DataInput) = native String DataInput.readLine(); /** |
From: <bo...@us...> - 2003-07-28 18:06:21
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv25004/src/bossa/syntax Modified Files: analyse.nice Log Message: Handle do/while loops for checking initialization of local variables. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** analyse.nice 27 Jul 2003 13:14:44 -0000 1.76 --- analyse.nice 28 Jul 2003 18:06:19 -0000 1.77 *************** *** 618,622 **** analyse(l@LoopStmt, info) { ! info.beginInner(); if (l.isTestFirst() && l.whileExp != null) --- 618,625 ---- analyse(l@LoopStmt, info) { ! // If the test comes before the body, then the body might not execute ! // at all, so we must discard its information. ! if (l.isTestFirst()) ! info.beginInner(); if (l.isTestFirst() && l.whileExp != null) *************** *** 648,652 **** l.whileExp = analyse(l.whileExp, info); ! info.endInner(); if (l.isInfinite()) --- 651,656 ---- l.whileExp = analyse(l.whileExp, info); ! if (l.isTestFirst()) ! info.endInner(); if (l.isInfinite()) |
From: <bo...@us...> - 2003-07-28 18:06:21
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/flow In directory sc8-pr-cvs1:/tmp/cvs-serv25004/testsuite/compiler/statements/flow Added Files: initialization.testsuite Log Message: Handle do/while loops for checking initialization of local variables. --- NEW FILE: initialization.testsuite --- /// PASS int i; do { i = 1; } while (false); int j = i; |
From: <bo...@us...> - 2003-07-28 17:50:53
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv21918/src/bossa/syntax Modified Files: EnumDefinition.java Log Message: Avoid creating a useless object. Index: EnumDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/EnumDefinition.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EnumDefinition.java 25 Jul 2003 16:13:10 -0000 1.3 --- EnumDefinition.java 28 Jul 2003 17:50:50 -0000 1.4 *************** *** 35,39 **** null,null); NiceClass impl = new NiceClass(classDef); ! impl.setFields(new ArrayList(0)); classDef.setImplementation(impl); --- 35,39 ---- null,null); NiceClass impl = new NiceClass(classDef); ! impl.setFields(null); classDef.setImplementation(impl); |
From: <bo...@us...> - 2003-07-28 11:13:42
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv15032/testsuite/compiler/classes Modified Files: initializer.testsuite Log Message: Prevent the 'this' symbol from leaking outside the scope of instance initializers. Index: initializer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/initializer.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** initializer.testsuite 18 Jul 2003 22:56:49 -0000 1.1 --- initializer.testsuite 28 Jul 2003 10:51:35 -0000 1.2 *************** *** 83,84 **** --- 83,97 ---- { T y = x; } } + + /// PASS + /// Toplevel + class test { + {this.doTest();} + void doTest() {} + } + + class test2 { + {this.doTest2();} + void doTest2() {} + } + |
From: <bo...@us...> - 2003-07-28 11:13:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15032/src/bossa/syntax Modified Files: NiceClass.java Log Message: Prevent the 'this' symbol from leaking outside the scope of instance initializers. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** NiceClass.java 27 Jul 2003 23:37:36 -0000 1.52 --- NiceClass.java 28 Jul 2003 10:51:35 -0000 1.53 *************** *** 221,224 **** --- 221,225 ---- } }; + Node.thisExp = new SymbolExp(thisSymbol, definition.location()); scope.addSymbol(thisSymbol); *************** *** 227,231 **** --- 228,234 ---- initializers[i] = bossa.syntax.dispatch.analyse (initializers[i], definition.scope, localScope, false); + Node.thisExp = null; + scope.removeSymbol(thisSymbol); } |
From: <bo...@us...> - 2003-07-28 10:04:52
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv8428/src/gnu/expr Modified Files: ModuleBody.java Log Message: Prevent ModuleBody to depend on Values, which is not available at runtime. Index: ModuleBody.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ModuleBody.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ModuleBody.java 21 Jul 2003 23:20:14 -0000 1.8 --- ModuleBody.java 28 Jul 2003 10:04:49 -0000 1.9 *************** *** 130,134 **** public Object apply0(ModuleMethod method) { ! return applyN(method, Values.noArgs); } --- 130,134 ---- public Object apply0(ModuleMethod method) { ! return applyN(method, ProcedureN.noArgs); } |
From: <bo...@us...> - 2003-07-28 10:04:52
|
Update of /cvsroot/nice/Nice/src/gnu/mapping In directory sc8-pr-cvs1:/tmp/cvs-serv8428/src/gnu/mapping Modified Files: ProcedureN.java Log Message: Prevent ModuleBody to depend on Values, which is not available at runtime. Index: ProcedureN.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/mapping/ProcedureN.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ProcedureN.java 25 Jul 2003 13:03:24 -0000 1.5 --- ProcedureN.java 28 Jul 2003 10:04:49 -0000 1.6 *************** *** 18,22 **** } ! private static final Object[] noArgs = new Object[0]; public Object apply0 () throws Throwable --- 18,22 ---- } ! public static final Object[] noArgs = new Object[0]; public Object apply0 () throws Throwable |
From: <ar...@us...> - 2003-07-27 23:37:40
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv16332/F:/nice/src/bossa/syntax Modified Files: NiceClass.java Log Message: Fix: set javatype of a class before resolving fields. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** NiceClass.java 26 Jul 2003 22:02:01 -0000 1.51 --- NiceClass.java 27 Jul 2003 23:37:36 -0000 1.52 *************** *** 169,176 **** classe.supers = computeSupers(); localScope = definition.getLocalScope(); resolveFields(); resolveIntitializers(); createConstructor(); - definition.setJavaType(classe.getType()); } --- 169,176 ---- classe.supers = computeSupers(); localScope = definition.getLocalScope(); + definition.setJavaType(classe.getType()); resolveFields(); resolveIntitializers(); createConstructor(); } |
From: <ar...@us...> - 2003-07-27 23:37:40
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv16332/F:/nice/testsuite/compiler/classes Modified Files: fields.testsuite Log Message: Fix: set javatype of a class before resolving fields. Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/fields.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** fields.testsuite 23 Feb 2003 11:04:22 -0000 1.9 --- fields.testsuite 27 Jul 2003 23:37:36 -0000 1.10 *************** *** 94,95 **** --- 94,102 ---- String s; } + + /// PASS + /// Toplevel + class Foo {} + class Bar { + final Class[] classes = [Foo.class, Bar.class]; + } |