nice-commit Mailing List for The Nice Programming Language (Page 18)
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: Daniel B. <bo...@us...> - 2005-03-06 12:56:08
|
Update of /cvsroot/nice/Nice/src/nice/tools/visibility In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24573/src/nice/tools/visibility Added Files: tests.nice impl.nice api.nice MultiMap.nice Log Message: Added the nice.tools.visibility package. Use it for global scoping of (non-type) symbols. No functionality change yet. --- NEW FILE: MultiMap.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2005 */ /* */ /* 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 nice.tools.visibility; /** Mapping keys to lists of values. @author Daniel Bonniot (bo...@us...) */ class MultiMap<K,V> { void add(K key, V value) { ?List<V> values = map[key]; if (values == null) { values = new LinkedList(); map[key] = notNull(values); } // We could as well add at the end. // Temporarily, we add at the begining to match the previous implementation // so as not to cause random changes due to known bugs. notNull(values).add(0, value); } void remove(K key, V value) { ?List<V> values = map[key]; if (values == null) return; values.remove(value); } ?List<V> get(K key) = map[key]; private HashMap<K,List<V>> map = new HashMap(); } --- NEW FILE: impl.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2005 */ /* */ /* 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 nice.tools.visibility; /** Implementation. @author Daniel Bonniot (bo...@us...) */ private <Sym> ?List<Sym> maybeGet(?Scope<Sym> s, String key) = s == null ? null : s.map[key]; add(Scope this, key, value, visibility) = map.add(key, value); add(Scope this, key, value, familial) { super; if (parent != null) notNull(parent).add(key, value, intimate); } add(Scope this, key, value, general) { super; publicMap.add(key, value); } remove(Scope this, key, value) { map.remove(key, value); publicMap.remove(key, value); } addImplicitOpen(Scope this, Scope scope) = opens.add(scope); <Sym> get(Scope this, root, key) = this.getScope(root).maybeGet(key) || empty; <Sym> get(Scope this, key) = map[key] || parent.maybeGet(key) || opens[key] || empty; <Sym> ?List<Sym> get(List<Scope<Sym>> scopes, String key) { ?List<Sym> res = null; for (Scope<Sym> scope : scopes) { let partial = scope.publicMap[key]; if (partial != null) { if (res == null) res = new LinkedList(); notNull(res).addAll(partial); } } return res; } private <Sym> ?Scope<Sym> getScope(Scope<Sym> this, String root) { if (this.name.equals(root)) return this; if (parent != null) { let res = notNull(parent).getScope(root); if (res != null) return res; } ?Scope<Sym> s = opens.search(Scope<Sym> s => s.name.equals(root)); return s; } --- NEW FILE: tests.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2005 */ /* */ /* 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 nice.tools.visibility; /** Tests. @author Daniel Bonniot (bo...@us...) */ void _testSingle() { Scope<char> s = new Scope(name: "root", parent: null); List<char> res; res = s.get("foo"); assert res.size == 0; s.add("a", 'b'); res = s.get("a"); assert res.size == 1 && res[0] == 'b'; res = s.get("root", "a"); assert res.size == 1 && res[0] == 'b'; s.add("a", 'c'); res = s.get("a"); assert res.size == 2 && res.contains('b') && res.contains('c'); } void _testNesting() { Scope<char> root = new Scope(name: "root", parent: null); Scope<char> inner = new Scope(name: "inner", parent: root); List<char> res; res = inner.get("foo"); assert res.size == 0; root.add("a", 'r'); res = inner.get("a"); assert res.size == 1 && res[0] == 'r'; inner.add("a", 'i'); res = inner.get("a"); assert res.size == 1 && res[0] == 'i'; res = inner.get("root", "a"); assert res.size == 1 && res[0] == 'r'; inner.add("a", 'j'); res = inner.get("a"); assert res.size == 2 && res.contains('i') && res.contains('j'); } void _testOpen() { Scope<char> pkg1 = new Scope(name: "pkg1", parent: null); Scope<char> pkg2 = new Scope(name: "pkg2", parent: null); pkg2.add("a", '2', general); List<char> res; res = pkg1.get("a"); assert res.size == 0; pkg1.addImplicitOpen(pkg2); res = pkg1.get("a"); assert res.size == 1 && res[0] == '2'; pkg1.add("a", '1'); res = pkg1.get("a"); assert res.size == 1 && res[0] == '1'; res = pkg1.get("pkg1", "a"); assert res.size == 1 && res[0] == '1'; res = pkg1.get("pkg2", "a"); assert res.size == 1 && res[0] == '2'; pkg1.add("a", '0'); res = pkg1.get("a"); assert res.size == 2 && res.contains('0') && res.contains('1'); } void _testNestingOpen() { Scope<char> root = new Scope(name: "root", parent: null); Scope<char> pkg1 = new Scope(name: "pkg1", parent: root); Scope<char> pkg2 = new Scope(name: "pkg2", parent: null); root.add("a", '0'); pkg2.add("a", '2'); List<char> res; res = pkg1.get("a"); assert res.size == 1 && res[0] == '0'; pkg1.addImplicitOpen(pkg2); res = pkg1.get("a"); assert res.size == 1 && res[0] == '0'; pkg1.add("a", '1'); res = pkg1.get("a"); assert res.size == 1 && res[0] == '1'; res = pkg1.get("root", "a"); assert res.size == 1 && res[0] == '0'; res = pkg1.get("pkg2", "a"); assert res.size == 1 && res[0] == '2'; pkg1.add("a", '+'); res = pkg1.get("a"); assert res.size == 2 && res.contains('1') && res.contains('+'); } void _testMultiOpen() { Scope<char> cur = new Scope(name: "cur", parent: null); Scope<char> pkg1 = new Scope(name: "pkg1", parent: null); Scope<char> pkg2 = new Scope(name: "pkg2", parent: null); cur.addImplicitOpen(pkg1); cur.addImplicitOpen(pkg2); pkg1.add("a", '1', general); List<char> res; res = cur.get("a"); assert res.size == 1 && res[0] == '1'; pkg2.add("a", '2', general); res = cur.get("a"); assert res.size == 2 && res.contains('1') && res.contains('2'); cur.add("a", '0'); res = cur.get("a"); assert res.size == 1 && res[0] == '0'; res = cur.get("pkg1", "a"); assert res.size == 1 && res[0] == '1'; res = cur.get("pkg2", "a"); assert res.size == 1 && res[0] == '2'; } void _testVisibility() { Scope<char> root = new Scope(name: "root", parent: null); Scope<char> inner1 = new Scope(name: "inner1", parent: root); Scope<char> inner2 = new Scope(name: "inner2", parent: root); List<char> res; inner1.add("i", 'i', intimate); res = inner1.get("i"); assert res.size == 1 && res[0] == 'i'; res = inner2.get("i"); assert res.size == 0; res = root.get("i"); assert res.size == 0; root.add("i", 'r', intimate); res = inner1.get("i"); assert res.size == 1 && res[0] == 'i'; res = inner1.get("root", "i"); assert res.size == 1 && res[0] == 'r'; res = inner2.get("root", "i"); assert res.size == 1 && res[0] == 'r'; inner1.add("f", 'f', familial); res = inner1.get("f"); assert res.size == 1 && res[0] == 'f'; res = inner2.get("f"); assert res.size == 1 && res[0] == 'f'; res = root.get("f"); assert res.size == 1 && res[0] == 'f'; } void _testGeneralVisibility() { Scope<char> pkg1 = new Scope(name: "pkg1", parent: null); Scope<char> pkg2 = new Scope(name: "pkg2", parent: null); pkg1.addImplicitOpen(pkg2); pkg2.add("b", '4'); pkg2.add("c", '5', familial); List<char> res; res = pkg1.get("b"); assert res.size == 0; res = pkg1.get("c"); assert res.size == 0; pkg2.add("a", '2', general); res = pkg1.get("a"); assert res.size == 1 && res[0] == '2'; pkg1.add("a", '1'); res = pkg1.get("a"); assert res.size == 1 && res[0] == '1'; res = pkg1.get("pkg1", "a"); assert res.size == 1 && res[0] == '1'; res = pkg1.get("pkg2", "a"); assert res.size == 1 && res[0] == '2' ; pkg1.add("a", '0'); res = pkg1.get("a"); assert res.size == 2 && res.contains('0') && res.contains('1'); } --- NEW FILE: api.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2005 */ /* */ /* 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 nice.tools.visibility; /** A generic visibility system. @author Daniel Bonniot (bo...@us...) */ enum Visibility { intimate, familial, general } class Scope<Sym> { String name; final ?Scope<Sym> parent; void add(String, Sym, Visibility visibility = intimate); void remove(String, Sym); List<Sym> get(String root, String key); List<Sym> get(String key); void addImplicitOpen(Scope<Sym>); private MultiMap<String, Sym> map = new MultiMap(); private MultiMap<String, Sym> publicMap = new MultiMap(); private List<Scope<Sym>> opens = new LinkedList(); private List<Sym> empty = new Sym[0]; } |
From: Daniel B. <bo...@us...> - 2005-03-06 12:35:41
|
Update of /cvsroot/nice/Nice/src/nice/tools/visibility In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18109/src/nice/tools/visibility Log Message: Directory /cvsroot/nice/Nice/src/nice/tools/visibility added to the repository |
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv499/src/bossa/syntax Modified Files: typedef.nice tools.nice scope.nice retypedMethod.nice pattern.nice nicefieldaccess.nice niceclass.nice niceMethod.nice methodbody.nice methodImplementation.nice methodDeclaration.nice methodContainer.nice javaclass.nice javaMethod.nice javaFieldAccess.nice inline.nice importedconstructor.nice globalvar.nice enum.nice dispatch.java.bootstrap defaultMethod.nice customConstructor.nice ast.nice analyse.nice alternative.nice ai.nice VarScope.java TypeScope.java Node.java Module.java Definition.java Log Message: Made bossa.syntax.Module represent a visibility unit (typically a file). Scopes are still global. This change will later allow to make each Module have its own scope, to implement 'private'. Index: scope.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/scope.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scope.nice 20 Dec 2004 20:25:53 -0000 1.3 --- scope.nice 6 Mar 2005 01:34:26 -0000 1.4 *************** *** 22,29 **** { // If there is any method by that name waiting, load it. ! loadJavaMethods(i.toString()); return super; } } --- 22,31 ---- { // If there is any method by that name waiting, load it. ! loadJavaMethods(i.toString(), this); return super; } + + globalLookup(i) = this.lookup(i); } *************** *** 39,51 **** public class GlobalTypeScope extends TypeScope { ! public Module module = cast(null); ! private Set<String> set; ! setModule(mod) { ! module = notNull(mod); } ! getModule() = module; addMapping(name, s) --- 41,53 ---- public class GlobalTypeScope extends TypeScope { ! public bossa.modules.Package pkg = cast(null); ! private Set<String> set = new HashSet(); ! setPackage(bossa.modules.Package pkg) { ! this.pkg = pkg; } ! getPackage() = pkg; addMapping(name, s) *************** *** 91,95 **** */ boolean first = true; ! String[] pkgs = module.listImplicitPackages(); for (int i = 0; i < pkgs.length; i++) { --- 93,97 ---- */ boolean first = true; ! String[] pkgs = pkg.listImplicitPackages(); for (int i = 0; i < pkgs.length; i++) { *************** *** 113,117 **** return res; ! return cast(lookupJavaClass(notNull(name), loc)); } } --- 115,119 ---- return res; ! return cast(lookupJavaClass(notNull(name), loc, Module.javaScope)); } } *************** *** 119,123 **** TypeScope createGlobalTypeScope() { ! let res = new GlobalTypeScope(null, set: new HashSet()); try { --- 121,125 ---- TypeScope createGlobalTypeScope() { ! let res = new GlobalTypeScope(null); try { Index: enum.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/enum.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** enum.nice 1 Mar 2005 17:36:36 -0000 1.18 --- enum.nice 6 Mar 2005 01:34:26 -0000 1.19 *************** *** 78,82 **** classDef.setImplementation(impl); ! if (! notNull(Definition.currentModule).interfaceFile()) // create the method implementation of family() globalDefs.add(createMethodBodyDefinition(impl, new LocatedString("family"), --- 78,82 ---- classDef.setImplementation(impl); ! if (! notNull(Definition.currentModule).compiled()) // create the method implementation of family() globalDefs.add(createMethodBodyDefinition(impl, new LocatedString("family"), *************** *** 134,138 **** res = new gnu.expr.Declaration(notNull(name).toString(), nice.tools.code.Types.javaType(type)); this.setDeclaration(notNull(res)); ! definition.module.addGlobalVar(res, true); } --- 134,138 ---- res = new gnu.expr.Declaration(notNull(name).toString(), nice.tools.code.Types.javaType(type)); this.setDeclaration(notNull(res)); ! definition.module.pkg.addGlobalVar(res, true); } Index: globalvar.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** globalvar.nice 16 Jan 2005 00:28:21 -0000 1.6 --- globalvar.nice 6 Mar 2005 01:34:26 -0000 1.7 *************** *** 81,85 **** } ! definition.module.addGlobalVar(res, definition.constant); } --- 81,85 ---- } ! definition.module.pkg.addGlobalVar(res, definition.constant); } Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** niceclass.nice 4 Mar 2005 02:25:03 -0000 1.25 --- niceclass.nice 6 Mar 2005 01:34:26 -0000 1.26 *************** *** 67,71 **** and only adds or modifies features when needed. */ ! classe = notNull(definition.module).getClassExp(this); } --- 67,71 ---- and only adds or modifies features when needed. */ ! classe = definition.module.pkg.getClassExp(this); } *************** *** 386,390 **** res.setSimple(true); res.setAccessFlags(definition.getBytecodeFlags()); ! definition.module.addUserClass(res); return res; } --- 386,390 ---- res.setSimple(true); res.setAccessFlags(definition.getBytecodeFlags()); ! definition.module.pkg.addUserClass(res); return res; } Index: javaMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaMethod.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** javaMethod.nice 16 Jan 2005 00:28:21 -0000 1.8 --- javaMethod.nice 6 Mar 2005 01:34:26 -0000 1.9 *************** *** 208,212 **** * to make them available to the nice code. */ ! void fetchMethods(mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType) { try { --- 208,212 ---- * to make them available to the nice code. */ ! void fetchMethods(mlsub.typing.TypeConstructor tc, gnu.bytecode.ClassType classType, VarScope scope) { try { *************** *** 215,219 **** for (?gnu.bytecode.Field f = classType.getFields(); f != null; f = f.getNext()) if (retyped.get(f) == null) ! addJavaSymbol(f, makeJavaFieldAccess(f)); for (?gnu.bytecode.Method m = classType.getMethods(); m != null; m = m.getNext()) --- 215,219 ---- for (?gnu.bytecode.Field f = classType.getFields(); f != null; f = f.getNext()) if (retyped.get(f) == null) ! addJavaSymbol(f, makeJavaFieldAccess(f), scope); for (?gnu.bytecode.Method m = classType.getMethods(); m != null; m = m.getNext()) *************** *** 301,305 **** /** Called when the given name is going to be needed. */ ! void loadJavaMethods(String name) { ?List<gnu.bytecode.Method> methods = knownMethods.get(name); --- 301,305 ---- /** Called when the given name is going to be needed. */ ! void loadJavaMethods(String name, VarScope scope) { ?List<gnu.bytecode.Method> methods = knownMethods.get(name); *************** *** 316,329 **** continue; ! addJavaSymbol(m, makeJavaMethod(m, false)); } } ! void addJavaSymbol(gnu.bytecode.AttrContainer m, ?MethodDeclaration def) { ! if (def == null || Node.getGlobalScope() == null) return; ! Node.getGlobalScope().addSymbol(def.getSymbol()); retyped.put(m, def); } --- 316,329 ---- continue; ! addJavaSymbol(m, makeJavaMethod(m, false), scope); } } ! void addJavaSymbol(gnu.bytecode.AttrContainer m, ?MethodDeclaration def, VarScope scope) { ! if (def == null) return; ! scope.addSymbol(def.getSymbol()); retyped.put(m, def); } Index: Definition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Definition.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Definition.java 26 Nov 2004 20:26:02 -0000 1.26 --- Definition.java 6 Mar 2005 01:34:26 -0000 1.27 *************** *** 70,74 **** public boolean inInterfaceFile() { ! return module.interfaceFile(); } --- 70,74 ---- public boolean inInterfaceFile() { ! return module.compiled(); } Index: retypedMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/retypedMethod.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** retypedMethod.nice 16 Jan 2005 21:51:15 -0000 1.7 --- retypedMethod.nice 6 Mar 2005 01:34:26 -0000 1.8 *************** *** 238,245 **** res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); return res; } --- 238,242 ---- res.addChild(parameters); ! res.setSymbol(new MethodSymbol(res, name, constraint, returnType)); return res; } *************** *** 254,258 **** let Map<gnu.bytecode.AttrContainer,MethodDeclaration> retyped = new HashMap(); ! void registerNativeMethod(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod) { ?MethodDeclaration auto = retyped.put(reflectMethod, m); --- 251,255 ---- let Map<gnu.bytecode.AttrContainer,MethodDeclaration> retyped = new HashMap(); ! private void registerNativeMethod(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod) { ?MethodDeclaration auto = retyped.put(reflectMethod, m); *************** *** 269,273 **** } ! void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod, mlsub.typing.TypeConstructor classe) { --- 266,270 ---- } ! private void registerNativeConstructor(RetypedJavaMethod m, gnu.bytecode.Method reflectMethod, mlsub.typing.TypeConstructor classe) { *************** *** 294,298 **** private void removeFromScope(MethodDeclaration m) { ! Node.getGlobalScope().removeSymbol(m.getSymbol()); unregisterDispatchTest(m); } --- 291,295 ---- private void removeFromScope(MethodDeclaration m) { ! Module.javaScope.removeSymbol(m.getSymbol()); unregisterDispatchTest(m); } Index: niceMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** niceMethod.nice 28 Feb 2005 14:01:07 -0000 1.19 --- niceMethod.nice 6 Mar 2005 01:34:26 -0000 1.20 *************** *** 44,50 **** // any other known method, there is an explicit override keyword. // So we can avoid looking for specializations when there isn't one. ! if (isOverride || ! module.interfaceFile()) { ! homonyms = Node.getGlobalScope().lookup(this.getName()); if (notNull(homonyms).size() == 1) homonyms = null; --- 44,50 ---- // any other known method, there is an explicit override keyword. // So we can avoid looking for specializations when there isn't one. ! if (isOverride || ! module.compiled()) { ! homonyms = module.scope.lookup(this.getName()); if (notNull(homonyms).size() == 1) homonyms = null; *************** *** 113,117 **** // If the method is imported, // check if the reverse relation holds with that method ! if (d.module != null && d.module.interfaceFile() && mlsub.typing.Typing.smaller(itsDomain, ourDomain, true) && ! nice.tools.typing.Types.typeParameterDispatch(s.getType(), this.getType())) --- 113,117 ---- // If the method is imported, // check if the reverse relation holds with that method ! if (d.module != null && d.module.compiled() && mlsub.typing.Typing.smaller(itsDomain, ourDomain, true) && ! nice.tools.typing.Types.typeParameterDispatch(s.getType(), this.getType())) *************** *** 136,140 **** // In a compiled package, we don't need checking. ! if (module.interfaceFile()) { this.addSpecializedMethod(d); --- 136,140 ---- // In a compiled package, we don't need checking. ! if (module.compiled()) { this.addSpecializedMethod(d); *************** *** 181,185 **** /** @return a string that uniquely represents this method */ ! getFullName() = module.getName() + '.' + name + ':' + this.getType(); computeCode() = getDispatchMethod(this, module); --- 181,185 ---- /** @return a string that uniquely represents this method */ ! getFullName() = module.pkg.getName() + '.' + name + ':' + this.getType(); computeCode() = getDispatchMethod(this, module); *************** *** 213,221 **** res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); ! return res; } --- 213,218 ---- res.addChild(parameters); ! res.setSymbol(new MethodSymbol(res, name, constraint, returnType)); ! return res; } *************** *** 353,357 **** as the precise types are found during typechecking. */ ! ?gnu.bytecode.Method meth = module.lookupDispatchClassMethod (receiver == null ? null : receiver.getClassType(), name, "id", def.getFullName()); --- 350,354 ---- as the precise types are found during typechecking. */ ! ?gnu.bytecode.Method meth = module.pkg.lookupDispatchClassMethod (receiver == null ? null : receiver.getClassType(), name, "id", def.getFullName()); *************** *** 389,392 **** return receiver.addJavaMethod(res); else ! return module.addMethod(res, false); } --- 386,389 ---- return receiver.addJavaMethod(res); else ! return module.pkg.addMethod(res, false); } Index: methodbody.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodbody.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** methodbody.nice 16 Jan 2005 00:28:21 -0000 1.12 --- methodbody.nice 6 Mar 2005 01:34:26 -0000 1.13 *************** *** 253,257 **** //Resolution of the body is delayed to enable overloading ! resolvePatterns(notNull(typeScope), Node.getGlobalScope(), formals); symbols = notNull(scope).lookup(name); --- 253,257 ---- //Resolution of the body is delayed to enable overloading ! resolvePatterns(notNull(typeScope), module.scope, formals); symbols = notNull(scope).lookup(name); *************** *** 260,264 **** void lateBuildScope() { ! resolvePatternValues(formals); let s = this.findSymbol(notNull(symbols)); --- 260,264 ---- void lateBuildScope() { ! resolvePatternValues(formals, module.scope); let s = this.findSymbol(notNull(symbols)); Index: VarScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** VarScope.java 14 Jan 2005 18:53:54 -0000 1.21 --- VarScope.java 6 Mar 2005 01:34:26 -0000 1.22 *************** *** 83,86 **** --- 83,94 ---- } + List globalLookup(LocatedString i) + { + if (outer != null) + return outer.globalLookup(i); + else + return null; + } + /**************************************************************** * Debugging Index: methodContainer.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodContainer.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** methodContainer.nice 16 Feb 2005 12:13:17 -0000 1.4 --- methodContainer.nice 6 Mar 2005 01:34:26 -0000 1.5 *************** *** 32,36 **** { ! this.name.prepend(module.getName() + "."); } --- 32,36 ---- { ! this.name.prepend(module.pkg.getName() + "."); } Index: javaFieldAccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaFieldAccess.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** javaFieldAccess.nice 12 Feb 2005 14:44:30 -0000 1.6 --- javaFieldAccess.nice 6 Mar 2005 01:34:26 -0000 1.7 *************** *** 119,126 **** fieldName : fieldName ); res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, cst, returnType); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); return res; } --- 119,123 ---- fieldName : fieldName ); res.addChild(parameters); ! res.setSymbol(new MethodSymbol(res, name, cst, returnType)); return res; } Index: nicefieldaccess.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/nicefieldaccess.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** nicefieldaccess.nice 14 Jan 2005 16:41:27 -0000 1.11 --- nicefieldaccess.nice 6 Mar 2005 01:34:26 -0000 1.12 *************** *** 56,63 **** res.addChild(params); ! let symbol = new MethodSymbol(res, field.getName(), constr, notNull(field.sym.syntacticType)); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); ! return res; } --- 56,60 ---- res.addChild(params); ! res.setSymbol(new MethodSymbol(res, field.getName(), constr, notNull(field.sym.syntacticType))); ! return res; } Index: alternative.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/alternative.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** alternative.nice 16 Jan 2005 21:51:15 -0000 1.10 --- alternative.nice 6 Mar 2005 01:34:26 -0000 1.11 *************** *** 374,378 **** * When read from a bytecode file. */ ! public void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, Location location) { ?gnu.bytecode.MiscAttr defattr = cast(gnu.bytecode.Attribute.get(method, "definition")); --- 374,378 ---- * When read from a bytecode file. */ ! public void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, Location location, Module module) { ?gnu.bytecode.MiscAttr defattr = cast(gnu.bytecode.Attribute.get(method, "definition")); *************** *** 383,387 **** String fullName = new String(defattr.data); ! registerJavaMethod(fullName); ?gnu.bytecode.MiscAttr attr = cast(gnu.bytecode.Attribute.get(method, "patterns")); --- 383,387 ---- String fullName = new String(defattr.data); ! registerJavaMethod(fullName, module.scope); ?gnu.bytecode.MiscAttr attr = cast(gnu.bytecode.Attribute.get(method, "patterns")); *************** *** 398,402 **** ?Pattern p; ! while ((p = readPattern(rep, at)) != null) { if (p.getTC() == nice.tools.typing.PrimitiveType.arrayTC) --- 398,402 ---- ?Pattern p; ! while ((p = readPattern(rep, at, module.scope)) != null) { if (p.getTC() == nice.tools.typing.PrimitiveType.arrayTC) *************** *** 430,434 **** to the link tests and dispatch code generation. */ ! private void registerJavaMethod(String fullName) { if (! fullName.startsWith("JAVA:")) --- 430,434 ---- to the link tests and dispatch code generation. */ ! private void registerJavaMethod(String fullName, VarScope scope) { if (! fullName.startsWith("JAVA:")) *************** *** 439,443 **** bossa.util.Location.nowhere()); ! for (VarSymbol sym : bossa.syntax.Node.getGlobalScope().lookup(methodName)) { if (sym.getMethodDeclaration() == null) --- 439,443 ---- bossa.util.Location.nowhere()); ! for (VarSymbol sym : scope.lookup(methodName)) { if (sym.getMethodDeclaration() == null) *************** *** 451,453 **** } } ! } \ No newline at end of file --- 451,453 ---- } } ! } Index: inline.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/inline.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** inline.nice 16 Jan 2005 00:28:21 -0000 1.4 --- inline.nice 6 Mar 2005 01:34:26 -0000 1.5 *************** *** 145,152 **** res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); ! return res; } --- 145,149 ---- res.addChild(parameters); ! res.setSymbol(new MethodSymbol(res, name, constraint, returnType)); ! return res; } Index: Module.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Module.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Module.java 28 Feb 2005 14:01:07 -0000 1.24 --- Module.java 6 Mar 2005 01:34:26 -0000 1.25 *************** *** 1,6 **** /**************************************************************************/ ! /* N I C E */ ! /* A simple imperative object-oriented research language */ ! /* (c) Daniel Bonniot 1999 */ /* */ /* This program is free software; you can redistribute it and/or modify */ --- 1,6 ---- /**************************************************************************/ ! /* N I C E */ ! /* A high-level object-oriented research language */ ! /* (c) Daniel Bonniot 2005 */ /* */ /* This program is free software; you can redistribute it and/or modify */ *************** *** 14,39 **** /** ! A Nice module. ! @version $Date$ ! @author Daniel Bonniot */ ! public interface Module extends mlsub.compilation.Module { ! String[] listImplicitPackages(); ! bossa.modules.Compilation compilation(); ! boolean interfaceFile(); ! /**************************************************************** ! * Code generation ! ****************************************************************/ ! gnu.bytecode.ClassType createClass(String name); ! void addGlobalVar(gnu.expr.Declaration declaration, boolean constant); ! gnu.bytecode.Method lookupDispatchClassMethod(gnu.bytecode.ClassType clas, String name, String attribute, String value); ! gnu.expr.ReferenceExp addMethod(gnu.expr.LambdaExp method, ! boolean packageMethod); ! gnu.expr.ClassExp getClassExp(Object def); ! void addUserClass(gnu.expr.ClassExp classe); } --- 14,41 ---- /** ! The smallest unit containing code (typically, the content of a file). ! Definitions marked as 'private' are only visible inside their Module. */ ! public class Module { ! public final bossa.modules.Package pkg; ! VarScope scope; ! String name; ! static VarScope javaScope; ! public Module(bossa.modules.Package pkg, String name, VarScope scope) ! { ! this.pkg = pkg; ! this.name = name; ! this.scope = scope; ! ! javaScope = scope; ! } ! ! bossa.modules.Compilation compilation() { return pkg.getCompilation(); } ! ! public boolean compiled() { return pkg.interfaceFile(); } } Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** analyse.nice 4 Mar 2005 02:25:03 -0000 1.132 --- analyse.nice 6 Mar 2005 01:34:26 -0000 1.133 *************** *** 178,184 **** ?VarSymbol lookup(String name) = this.vars[name]; ! List<VarSymbol> globalLookup(LocatedString name) = this.outerVarScope.lookup(name); ?mlsub.typing.TypeSymbol lookupType(LocatedString name) { --- 178,187 ---- ?VarSymbol lookup(String name) = this.vars[name]; ! List<VarSymbol> outerLookup(LocatedString name) = this.outerVarScope.lookup(name); + List<VarSymbol> globalLookup(LocatedString name) = + this.outerVarScope.globalLookup(name); + ?mlsub.typing.TypeSymbol lookupType(LocatedString name) { *************** *** 510,516 **** ?List<VarSymbol> symbols; if (e.isInfix()) - symbols = cast(notNull(Node.getGlobalScope()).lookup(e.ident)); - else symbols = info.globalLookup(e.ident); if (symbols != null && symbols.size() > 0) --- 513,519 ---- ?List<VarSymbol> symbols; if (e.isInfix()) symbols = info.globalLookup(e.ident); + else + symbols = info.outerLookup(e.ident); if (symbols != null && symbols.size() > 0) Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** customConstructor.nice 22 Feb 2005 13:09:44 -0000 1.23 --- customConstructor.nice 6 Mar 2005 01:34:26 -0000 1.24 *************** *** 155,162 **** res.addChild(params); ! let symbol = new MethodSymbol(res, name, cst, returnType); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); return res; } --- 155,159 ---- res.addChild(params); ! res.setSymbol(new MethodSymbol(res, name, cst, returnType)); return res; } Index: Node.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Node.java 13 Jan 2005 16:47:33 -0000 1.67 --- Node.java 6 Mar 2005 01:34:26 -0000 1.68 *************** *** 118,127 **** */ - private static VarScope globalScope; - public static final VarScope getGlobalScope() - { - return globalScope; - } - private static TypeScope globalTypeScope; public static final TypeScope getGlobalTypeScope() --- 118,121 ---- *************** *** 130,136 **** } ! public static final Module getGlobalTypeScopeModule() { ! return globalTypeScope.getModule(); } --- 124,130 ---- } ! public static final bossa.modules.Package getGlobalTypeScopeModule() { ! return globalTypeScope.getPackage(); } *************** *** 142,162 **** public static bossa.modules.Compilation compilation = null; ! public static void setModule(Module module) { // For multiple compilations in the same JVM: // If we are starting a new compilation, reset the global scopes. ! if (compilation != module.compilation()) { ! compilation = module.compilation(); ! globalScope = dispatch.createGlobalVarScope(); globalTypeScope = dispatch.createGlobalTypeScope(); } ! globalTypeScope.setModule(module); } ! void buildScope(Module module) { ! setModule(module); ! buildScope(globalScope, globalTypeScope); } --- 136,155 ---- public static bossa.modules.Compilation compilation = null; ! public static void setPackage(bossa.modules.Package pkg) { // For multiple compilations in the same JVM: // If we are starting a new compilation, reset the global scopes. ! if (compilation != pkg.getCompilation()) { ! compilation = pkg.getCompilation(); globalTypeScope = dispatch.createGlobalTypeScope(); } ! globalTypeScope.setPackage(pkg); } ! void buildScope(bossa.modules.Package pkg) { ! setPackage(pkg); ! buildScope(null, globalTypeScope); } *************** *** 169,172 **** --- 162,168 ---- //Internal.error("Scope set twice for " + this + this.getClass()); + if (this instanceof Definition) + outer = ((Definition) this).module.scope; + switch(propagate) { *************** *** 181,187 **** case global: - outer = globalScope; - outer.addSymbols(varSymbols); this.scope = outer; typeOuter = globalTypeScope; this.typeScope = typeOuter; --- 177,182 ---- case global: this.scope = outer; + this.scope.addSymbols(varSymbols); typeOuter = globalTypeScope; this.typeScope = typeOuter; *************** *** 310,314 **** } catch(UserError ex){ ! globalTypeScope.getModule().compilation().error(ex); } } --- 305,309 ---- } catch(UserError ex){ ! globalTypeScope.getPackage().getCompilation().error(ex); } } Index: ai.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ai.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ai.nice 16 Jan 2005 00:28:21 -0000 1.6 --- ai.nice 6 Mar 2005 01:34:26 -0000 1.7 *************** *** 113,117 **** let ident = new TypeIdent ! (name: new LocatedString(module.getName() + '.' + interfaceName.content, interfaceName.location())); interfaceITF = ident.resolveToItf(notNull(typeScope)); --- 113,117 ---- let ident = new TypeIdent ! (name: new LocatedString(module.pkg.getName() + '.' + interfaceName.content, interfaceName.location())); interfaceITF = ident.resolveToItf(notNull(typeScope)); Index: typedef.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typedef.nice,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** typedef.nice 16 Feb 2005 22:35:06 -0000 1.19 --- typedef.nice 6 Mar 2005 01:34:26 -0000 1.20 *************** *** 482,488 **** superClass + " is an interface, so " + name + " may only implement it"); ! if (! nice.tools.code.Types.legalAccess(superClass, module.getName())) ! User.error(superClassIdent, name + " cannot extend " + ! superClass + ". It is not available to this package."); superClassIdent = null; --- 482,488 ---- superClass + " is an interface, so " + name + " may only implement it"); ! if (! nice.tools.code.Types.legalAccess(superClass, module.pkg.getName())) ! User.error(superClassIdent, name + " cannot extend " + ! superClass + ". It is not visible in this package."); superClassIdent = null; Index: methodDeclaration.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodDeclaration.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** methodDeclaration.nice 14 Jan 2005 16:41:27 -0000 1.3 --- methodDeclaration.nice 6 Mar 2005 01:34:26 -0000 1.4 *************** *** 37,40 **** --- 37,53 ---- ?gnu.expr.Expression code = null; + void setSymbol(MethodSymbol symbol) + { + this.symbol = symbol; + symbol.propagate = Node.none; + this.addChild(symbol); + } + + buildScope(outer, typeOuter) + { + module.scope.addSymbol(symbol); + super; + } + public ?mlsub.typing.Polytype getType() { *************** *** 67,71 **** void typedResolve() { ! if (module.interfaceFile() && ! notNull(parameters).hasDefaultValue()) return; --- 80,84 ---- void typedResolve() { ! if (module.compiled() && ! notNull(parameters).hasDefaultValue()) return; Index: methodImplementation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** methodImplementation.nice 20 Feb 2005 22:09:40 -0000 1.13 --- methodImplementation.nice 6 Mar 2005 01:34:26 -0000 1.14 *************** *** 165,169 **** { this.createMethod(name.toString()); ! gnu.expr.ReferenceExp ref = module.addMethod(compiledMethod, true); return ref; --- 165,169 ---- { this.createMethod(name.toString()); ! gnu.expr.ReferenceExp ref = module.pkg.addMethod(compiledMethod, true); return ref; Index: TypeScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeScope.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** TypeScope.java 16 Feb 2005 22:35:06 -0000 1.42 --- TypeScope.java 6 Mar 2005 01:34:26 -0000 1.43 *************** *** 32,37 **** // only for GlobalTypeScope ! void setModule(Module mod) {} ! Module getModule() { return null; } public mlsub.typing.TypeConstructor globalLookup(String name, Location loc) { return null; } --- 32,37 ---- // only for GlobalTypeScope ! void setPackage(bossa.modules.Package pkg) {} ! bossa.modules.Package getPackage() { return null; } public mlsub.typing.TypeConstructor globalLookup(String name, Location loc) { return null; } Index: pattern.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/pattern.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pattern.nice 12 Feb 2005 17:48:39 -0000 1.20 --- pattern.nice 6 Mar 2005 01:34:26 -0000 1.21 *************** *** 213,220 **** } ! void resolvePatternValues(Pattern[] patterns) { for (int i = 0; i < patterns.length; i++) ! patterns[i] = resolveGlobalConstants(patterns[i]); } --- 213,220 ---- } ! void resolvePatternValues(Pattern[] patterns, VarScope scope) { for (int i = 0; i < patterns.length; i++) ! patterns[i] = resolveGlobalConstants(patterns[i], scope); } *************** *** 691,697 **** ! private ?VarSymbol findRefSymbol(LocatedString refName) { ! for (sym : Node.getGlobalScope().lookup(refName)) if (sym instanceof GlobalVarSymbol || sym instanceof EnumSymbol ) --- 691,697 ---- ! private ?VarSymbol findRefSymbol(LocatedString refName, VarScope scope) { ! for (sym : scope.lookup(refName)) if (sym instanceof GlobalVarSymbol || sym instanceof EnumSymbol ) *************** *** 701,714 **** } ! Pattern resolveGlobalConstants(Pattern pattern) { return pattern; } ! resolveGlobalConstants(IntComparePattern pattern) { if (pattern.refName != null) { ! let symbol = findRefSymbol(notNull(pattern.refName)); if (symbol instanceof GlobalVarSymbol) { --- 701,714 ---- } ! Pattern resolveGlobalConstants(Pattern pattern, VarScope scope) { return pattern; } ! resolveGlobalConstants(IntComparePattern pattern, scope) { if (pattern.refName != null) { ! let symbol = findRefSymbol(notNull(pattern.refName), scope); if (symbol instanceof GlobalVarSymbol) { *************** *** 725,734 **** } ! resolveGlobalConstants(VariablePattern pattern) { if (pattern.name == null) return pattern; ! let symbol = findRefSymbol(notNull(pattern.name)); if (symbol == null) return pattern; --- 725,734 ---- } ! resolveGlobalConstants(VariablePattern pattern, scope) { if (pattern.name == null) return pattern; ! let symbol = findRefSymbol(notNull(pattern.name), scope); if (symbol == null) return pattern; *************** *** 783,787 **** bytecodeRepresentation(ReferencePattern p) = "@=" + p.name; ! public ?Pattern readPattern(String rep, int[]/*ref*/ pos) { int cpos = pos[0]; --- 783,787 ---- bytecodeRepresentation(ReferencePattern p) = "@=" + p.name; ! public ?Pattern readPattern(String rep, int[]/*ref*/ pos, VarScope scope) { int cpos = pos[0]; *************** *** 845,849 **** if (name[0] == '=') ! return resolveGlobalConstants(new VariablePattern(name: new LocatedString(name.substring(1)), loc: loc)); } --- 845,849 ---- if (name[0] == '=') ! return resolveGlobalConstants(new VariablePattern(name: new LocatedString(name.substring(1)), loc: loc), scope); } Index: javaclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/javaclass.nice,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** javaclass.nice 16 Jan 2005 00:28:21 -0000 1.6 --- javaclass.nice 6 Mar 2005 01:34:26 -0000 1.7 *************** *** 72,76 **** return; ! fetchMethods(definition.getTC(), cast(definition.getJavaType())); } --- 72,76 ---- return; ! fetchMethods(definition.getTC(), cast(definition.getJavaType()), Module.javaScope); } *************** *** 114,119 **** } ! mlsub.typing.TypeConstructor createJavaType(bossa.modules.Compilation compilation, String className, ! gnu.bytecode.Type javaType) { if (bossa.util.Debug.javaTypes) --- 114,120 ---- } ! mlsub.typing.TypeConstructor createJavaType ! (bossa.modules.Compilation compilation, String className, ! gnu.bytecode.Type javaType, VarScope scope) { if (bossa.util.Debug.javaTypes) *************** *** 207,212 **** if (javaType instanceof gnu.bytecode.ClassType) ! fetchMethods(res, javaType); ! return res; } --- 208,213 ---- if (javaType instanceof gnu.bytecode.ClassType) ! fetchMethods(res, javaType, scope); ! return res; } *************** *** 234,238 **** } ! ?mlsub.typing.TypeConstructor lookupJavaClass(String className, ?Location loc) { let classType = nice.tools.code.TypeImport.lookup(className, loc); --- 235,240 ---- } ! ?mlsub.typing.TypeConstructor lookupJavaClass(String className, ?Location loc, ! VarScope scope) { let classType = nice.tools.code.TypeImport.lookup(className, loc); *************** *** 246,249 **** return compilation.javaTypeConstructors.get(classType); ! return createJavaType(compilation, classType.getName(), classType); } --- 248,251 ---- return compilation.javaTypeConstructors.get(classType); ! return createJavaType(compilation, classType.getName(), classType, scope); } Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** tools.nice 16 Jan 2005 21:51:15 -0000 1.103 --- tools.nice 6 Mar 2005 01:34:26 -0000 1.104 *************** *** 187,190 **** --- 187,191 ---- ?mlsub.typing.TypeSymbol lookup(TypeMap, String) = native mlsub.typing.TypeSymbol TypeMap.lookup(String); List<VarSymbol> lookup(VarScope, LocatedString) = native List VarScope.lookup(LocatedString); + List<VarSymbol> globalLookup(VarScope, LocatedString) = native List VarScope.globalLookup(LocatedString); Map<gnu.bytecode.Type,mlsub.typing.TypeConstructor> javaTypeConstructors(bossa.modules.Compilation ) = native bossa.modules.Compilation.javaTypeConstructors; ?LocatedString name(Symbol) = native Symbol.name; *************** *** 216,219 **** --- 217,222 ---- gnu.expr.QuoteExp voidExp() = native gnu.expr.QuoteExp.voidExp; gnu.expr.QuoteExp QuoteExp_undefined_exp() = native gnu.expr.QuoteExp.undefined_exp; + GlobalVarScope scope(Module) = native Module.scope; + GlobalVarScope javaScope() = native Module.javaScope; // Local Variables: Index: importedconstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/importedconstructor.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** importedconstructor.nice 16 Feb 2005 12:13:17 -0000 1.15 --- importedconstructor.nice 6 Mar 2005 01:34:26 -0000 1.16 *************** *** 115,122 **** method: method); res.addChild(parameters); ! let symbol = new MethodSymbol(res, name, constraint, returnType); ! res.symbol = symbol; ! symbol.propagate = Node.global; ! res.addChild(symbol); addConstructor(res.classe.getDefinition().getTC(), res); --- 115,119 ---- method: method); res.addChild(parameters); ! res.setSymbol(new MethodSymbol(res, name, constraint, returnType)); addConstructor(res.classe.getDefinition().getTC(), res); Index: dispatch.java.bootstrap =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/dispatch.java.bootstrap,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** dispatch.java.bootstrap 15 Jan 2005 20:27:33 -0000 1.53 --- dispatch.java.bootstrap 6 Mar 2005 01:34:26 -0000 1.54 *************** *** 19,23 **** public static void resetDispatchTest() {} ! public static void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, bossa.util.Location location) {} static TypeScope createGlobalTypeScope() --- 19,23 ---- public static void resetDispatchTest() {} ! public static void readImportedAlternative(gnu.bytecode.ClassType c, gnu.bytecode.Method method, bossa.util.Location location, Module module) {} static TypeScope createGlobalTypeScope() *************** *** 28,32 **** public static void resetJavaClasses() {} ! static VarScope createGlobalVarScope() { return null; } --- 28,32 ---- public static void resetJavaClasses() {} ! public static VarScope createGlobalVarScope() { return null; } *************** *** 39,43 **** { return null; } ! public static AST createAST(Module module, List defs) { return null; } --- 39,43 ---- { return null; } ! public static AST createAST(bossa.modules.Package module, List defs) { return null; } Index: ast.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ast.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ast.nice 26 Nov 2004 20:26:02 -0000 1.1 --- ast.nice 6 Mar 2005 01:34:26 -0000 1.2 *************** *** 23,27 **** public class CAST extends AST { ! private Module module; private ArrayList<TypeDefinition> classes = new ArrayList(); private ArrayList<MethodDeclaration> methods = new ArrayList(); --- 23,27 ---- public class CAST extends AST { ! private bossa.modules.Package pkg; private ArrayList<TypeDefinition> classes = new ArrayList(); private ArrayList<MethodDeclaration> methods = new ArrayList(); *************** *** 56,60 **** buildScope() { ! this.buildScope(module); } --- 56,60 ---- buildScope() { ! this.buildScope(pkg); } *************** *** 64,68 **** n.doResolve(); } catch(UserError ex) { ! module.compilation().error(ex); } } --- 64,68 ---- n.doResolve(); } catch(UserError ex) { ! pkg.getCompilation().error(ex); } } *************** *** 70,74 **** resolveScoping() { ! Node.setModule(module); // Resolve custom constructors early, classes depend on them --- 70,74 ---- resolveScoping() { ! Node.setPackage(pkg); // Resolve custom constructors early, classes depend on them *************** *** 84,93 **** this.resolve(node); ! module.compilation().exitIfErrors(); } typedResolve() { ! Node.setModule(module); for (m : methods) --- 84,93 ---- this.resolve(node); ! pkg.getCompilation().exitIfErrors(); } typedResolve() { ! Node.setPackage(pkg); for (m : methods) *************** *** 95,99 **** m.typedResolve(); } catch(UserError ex) { ! module.compilation().error(ex); } --- 95,99 ---- m.typedResolve(); } catch(UserError ex) { ! pkg.getCompilation().error(ex); } *************** *** 102,114 **** mi.lateBuildScope(); } catch(UserError ex) { ! module.compilation().error(ex); } ! module.compilation().exitIfErrors(); } localResolve() { ! Node.setModule(module); for (d : children) --- 102,114 ---- mi.lateBuildScope(); } catch(UserError ex) { ! pkg.getCompilation().error(ex); } ! pkg.getCompilation().exitIfErrors(); } localResolve() { ! Node.setPackage(pkg); for (d : children) *************** *** 117,124 **** d.resolveBody(); } catch(UserError ex) { ! module.compilation().error(ex); } ! module.compilation().exitIfErrors(); for (c : classes) --- 117,124 ---- d.resolveBody(); } catch(UserError ex) { ! pkg.getCompilation().error(ex); } ! pkg.getCompilation().exitIfErrors(); for (c : classes) *************** *** 128,132 **** typechecking(compiling) { ! Node.setModule(module); // Classes are typechecked first, since code can depend on them. --- 128,132 ---- typechecking(compiling) { ! Node.setPackage(pkg); // Classes are typechecked first, since code can depend on them. *************** *** 144,148 **** this.doTypecheck(); ! module.compilation().exitIfErrors(); } --- 144,148 ---- this.doTypecheck(); ! pkg.getCompilation().exitIfErrors(); } *************** *** 178,185 **** } ! public AST createAST(Module module, ?List<Definition> defs) { ! let res = new CAST(defs || new ArrayList(), Node.global, module: module); res.findElements(); return res; ! } \ No newline at end of file --- 178,185 ---- } ! public AST createAST(bossa.modules.Package pkg, ?List<Definition> defs) { ! let res = new CAST(defs || new ArrayList(), Node.none, pkg: pkg); res.findElements(); return res; ! } Index: defaultMethod.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/defaultMethod.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** defaultMethod.nice 14 Jan 2005 16:41:27 -0000 1.8 --- defaultMethod.nice 6 Mar 2005 01:34:26 -0000 1.9 *************** *** 130,137 **** contract: contract, isOverride: isOverride, implementation: res); notNull(res.declaration).addChild(parameters); ! let symbol = new MethodSymbol(notNull(res.declaration), name, constraint, returnType); ! notNull(res.declaration).symbol = symbol; ! symbol.propagate = Node.global; ! notNull(res.declaration).addChild(symbol); res.addChild(res.declaration); --- 130,135 ---- contract: contract, isOverride: isOverride, implementation: res); notNull(res.declaration).addChild(parameters); ! notNull(res.declaration).setSymbol ! (new MethodSymbol(notNull(res.declaration), name, constraint, returnType)); res.addChild(res.declaration); |
From: Daniel B. <bo...@us...> - 2005-03-06 01:34:39
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv499/src/bossa/modules Modified Files: Package.java Content.java Compilation.nice Compilation.java Log Message: Made bossa.syntax.Module represent a visibility unit (typically a file). Scopes are still global. This change will later allow to make each Module have its own scope, to implement 'private'. Index: Compilation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.nice,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Compilation.nice 11 Aug 2004 16:09:36 -0000 1.30 --- Compilation.nice 6 Mar 2005 01:34:27 -0000 1.31 *************** *** 55,58 **** --- 55,59 ---- Map<String,Package> packages = new HashMap(); Map<String,mlsub.typing.TypeConstructor> javaTypeConstructors = new HashMap(); + bossa.syntax.VarScope globalScope = cast(null); void setMainPackage(String packageName) Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** Package.java 28 Feb 2005 14:01:07 -0000 1.137 --- Package.java 6 Mar 2005 01:34:27 -0000 1.138 *************** *** 33,37 **** @author Daniel Bonniot (bo...@us...) */ ! public class Package implements mlsub.compilation.Module, Located, bossa.syntax.Module { /**************************************************************** --- 33,37 ---- @author Daniel Bonniot (bo...@us...) */ ! public class Package implements mlsub.compilation.Module, Located { /**************************************************************** *************** *** 74,77 **** --- 74,80 ---- compilation.packages.put(name.toString(), this); + if (compilation.globalScope == null) + compilation.globalScope = bossa.syntax.dispatch.createGlobalVarScope(); + source = compilation.locator.find(this); if (source == null) *************** *** 113,120 **** private void read(boolean shouldReload) { ! Module oldModule = Definition.currentModule; ! Definition.currentModule = this; ! Node.setModule(this); ! compilation.progress(this, "parsing"); --- 116,121 ---- private void read(boolean shouldReload) { ! bossa.syntax.Node.setPackage(this); ! compilation.progress(this, "parsing"); *************** *** 128,135 **** // Inform compilation that at least one package is going to generate code compilation.recompilationNeeded = true; - - Definition.currentModule = oldModule; } ! void setOpens(Set opens) { --- 129,134 ---- // Inform compilation that at least one package is going to generate code compilation.recompilationNeeded = true; } ! void setOpens(Set opens) { *************** *** 155,160 **** method != null; method = method.getNext()) ! bossa.syntax.dispatch.readImportedAlternative(source.getBytecode(), method, ! location()); } --- 154,159 ---- method != null; method = method.getNext()) ! bossa.syntax.dispatch.readImportedAlternative ! (source.getBytecode(), method, location(), compiledModule); } *************** *** 831,835 **** Compilation compilation; ! public Compilation compilation() { return compilation; } /** --- 830,836 ---- Compilation compilation; ! public Compilation getCompilation() { return compilation; } ! ! bossa.syntax.Module compiledModule = null; /** Index: Compilation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Compilation.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Compilation.java 11 Aug 2004 16:09:36 -0000 1.10 --- Compilation.java 6 Mar 2005 01:34:27 -0000 1.11 *************** *** 36,39 **** --- 36,41 ---- public java.util.Map packages; public java.util.Map javaTypeConstructors; + + bossa.syntax.VarScope globalScope; } Index: Content.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Content.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Content.java 10 Aug 2004 17:22:19 -0000 1.17 --- Content.java 6 Mar 2005 01:34:27 -0000 1.18 *************** *** 68,72 **** readers = source.getDefinitions(); else ! readers = compiled.getDefinitions(); LinkedList imports = new LinkedList(); --- 68,75 ---- readers = source.getDefinitions(); else ! { ! pkg.compiledModule = new bossa.syntax.Module(pkg, pkg.getName(), pkg.compilation.globalScope); ! readers = compiled.getDefinitions(); ! } LinkedList imports = new LinkedList(); *************** *** 109,113 **** --- 112,123 ---- { bossa.util.Location.setCurrentFile(unit.file); + + bossa.syntax.Module module = pkg.compiledModule != null ? + pkg.compiledModule : new bossa.syntax.Module(pkg, unit.name, pkg.compilation.globalScope); + Definition.currentModule = module; + pkg.compilation.parser.read(unit.reader, definitions); + + Definition.currentModule = null; } |
From: Bryn K. <xo...@us...> - 2005-03-04 21:36:20
|
Update of /cvsroot/nice/Nice/stdlib/nice/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23336/stdlib/nice/io Modified Files: file.nice Log Message: nice.io builds and tests correctly. Index: file.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/io/file.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** file.nice 4 Mar 2005 09:48:16 -0000 1.2 --- file.nice 4 Mar 2005 21:36:09 -0000 1.3 *************** *** 52,56 **** * all subdirectories which match the filter. */ ! void->File traverse(File dir, File->boolean filter = always(true)) requires dir.isDirectory() : "Only directories can be passed to traverse()." { --- 52,58 ---- * all subdirectories which match the filter. */ ! void->File traverse(File dir, File->boolean filter = always(true), ! (File,File)->int sortBy = ! (File f, File f2) => f.compareTo(f2)) requires dir.isDirectory() : "Only directories can be passed to traverse()." { *************** *** 58,62 **** //Java doesn't do tail call elimination... let stack = new Stack(); ! var current = dir.listDir(filter).iterator(); return () => { while(!current.hasNext()) { --- 60,66 ---- //Java doesn't do tail call elimination... let stack = new Stack(); ! var list = dir.listDir(filter).toArrayList(); ! list.sort(sortBy); ! var current = list.iterator(); return () => { while(!current.hasNext()) { *************** *** 70,74 **** if (f.isDirectory()) { stack.push(current); ! current = f.listDir(filter).iterator(); } return f; --- 74,80 ---- if (f.isDirectory()) { stack.push(current); ! list = f.listDir(filter).toArrayList(); ! list.sort(sortBy); ! current = list.iterator(); } return f; *************** *** 134,138 **** new java.io.FileInputStream(file), encoding) ); ! void close() { input.close(); stop(); } return ()=> { try { --- 140,144 ---- new java.io.FileInputStream(file), encoding) ); ! String close() { input.close(); return stop(); } return ()=> { try { *************** *** 146,149 **** --- 152,183 ---- /** + * Writes all the lines yielded by the <code>lines</code> parameter + * to a file. + */ + void writeLines(File file, void->String lines, ?String encoding = null) + { + using(let writer = new java.io.BufferedWriter( + (encoding == null) + ? new java.io.FileWriter(file) + : new java.io.OutputStreamWriter( + new java.io.FileOutputStream(file), encoding))) + { + for(line:lines.iterator()) + { + writer.write(line); + writer.newLine(); + } + } + } + + /** + * Writes all the line in the list to a file. + */ + void writeLines(File file, List<String> lines, ?String encoding = null) + { + file.writeLines(lines.generator()); + } + + /** * Returns the standard temp directory. */ *************** *** 214,224 **** assert res.equals(file) : "Expected " + file + " got " + res; } - test(tmpdir/"one"/"two"); - test(tmpdir/"one"/"two"/"three"); - test(tmpdir/"one"/"two"/"c.txt"); - test(tmpdir/"one"/"four"); - test(tmpdir/"one"/"four"/"d.txt"); test(tmpdir/"one"/"a.txt"); test(tmpdir/"one"/"b.bmp"); try { gen(); --- 248,258 ---- assert res.equals(file) : "Expected " + file + " got " + res; } test(tmpdir/"one"/"a.txt"); test(tmpdir/"one"/"b.bmp"); + test(tmpdir/"one"/"four"); + test(tmpdir/"one"/"four"/"d.txt"); + test(tmpdir/"one"/"two"); + test(tmpdir/"one"/"two"/"c.txt"); + test(tmpdir/"one"/"two"/"three"); try { gen(); *************** *** 236,242 **** assert res.equals(file) : "Expected " + file + " got " + res; } test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); - test(tmpdir/"one"/"four"); try { gen(); --- 270,276 ---- assert res.equals(file) : "Expected " + file + " got " + res; } + test(tmpdir/"one"/"four"); test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); try { gen(); *************** *** 256,263 **** assert res.equals(file) : "Expected " + file + " got " + res; } test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); - test(tmpdir/"one"/"four"); - test(tmpdir/"one"/"b.bmp"); try { gen(); --- 290,297 ---- assert res.equals(file) : "Expected " + file + " got " + res; } + test(tmpdir/"one"/"b.bmp"); + test(tmpdir/"one"/"four"); test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); try { gen(); *************** *** 267,270 **** --- 301,318 ---- } + void _testLines() + { + let lines = ["Line 1", "Line 2", "Line 3"]; + let f = createTempFile("_testLines", ".tmp"); + f.writeLines(lines); + let lines2 = f.readLines().toList().toArray(); + f.delete(); + assert lines.size == lines2.size; + for(int i = 0; i < lines.size; i++) + { + assert lines[i].equals(lines2[i]): "Expected: " lines[i] ", got: " lines2[i]; + } + } + |
From: Bryn K. <xo...@us...> - 2005-03-04 21:36:20
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23336 Modified Files: Makefile build.xml Log Message: nice.io builds and tests correctly. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** Makefile 4 Mar 2005 09:48:17 -0000 1.160 --- Makefile 4 Mar 2005 21:36:08 -0000 1.161 *************** *** 212,216 **** @echo "Building libraries..." $(NICEC1) nice.functional ! # $(NICEC1) nice.io testengine: --- 212,216 ---- @echo "Building libraries..." $(NICEC1) nice.functional ! $(NICEC1) nice.io testengine: Index: build.xml =================================================================== RCS file: /cvsroot/nice/Nice/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.xml 28 Feb 2005 06:29:06 -0000 1.2 --- build.xml 4 Mar 2005 21:36:08 -0000 1.3 *************** *** 225,228 **** --- 225,229 ---- <target name="libs" depends="initialize"> <mac-nicec-new package="nice.functional" /> + <mac-nicec-new package="nice.io" /> </target> <target name="bootstrap" |
From: Daniel B. <bo...@us...> - 2005-03-04 09:48:59
|
Update of /cvsroot/nice/Nice/stdlib/nice/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8992/stdlib/nice/io Modified Files: file.nice Log Message: Fixed some errors in nice.io and end-of-line weirdnesses. Still disable its compilation since some errors remain. Index: file.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/io/file.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** file.nice 3 Mar 2005 23:50:04 -0000 1.1 --- file.nice 4 Mar 2005 09:48:16 -0000 1.2 *************** *** 101,114 **** */ String read(File file, ?String encoding = null) ! requires file.exists(): "File " file " does not exist", ! file.isFile(): file + " is not a normal file. Only normal files can be read." { let chars = new char[blockSize]; let buff = new StringBuffer(); ! let input = new BufferedReader( (encoding == null) ? new java.io.FileReader(file) : new java.io.InputStreamReader( ! new java.io.FileInputStream(file), encoding) ); using(input) { --- 101,114 ---- */ String read(File file, ?String encoding = null) ! requires file.exists(): "File " file " does not exist", ! file.isFile(): file + " is not a normal file. Only normal files can be read." { let chars = new char[blockSize]; let buff = new StringBuffer(); ! let input = new java.io.BufferedReader( (encoding == null) ? new java.io.FileReader(file) : new java.io.InputStreamReader( ! new java.io.FileInputStream(file), encoding) ); using(input) { *************** *** 118,150 **** } return buff.toString(); ! } ! ! /** ! * Opens a file and returns a generator which yields the lines contained in the file, ! * one by one. ! */ ! void->String readLines(File file, ?encoding = null) ! requires file.exists(): "File " file " does not exist", ! file.isFile(): file + " is not a normal file. Only normal files can be read." ! { ! let input = new BufferedReader( (encoding == null) ? new java.io.FileReader(file) : new java.io.InputStreamReader( ! new java.io.FileInputStream(file), encoding) ! ); ! void close() { input.close(); stop(); } ! return ()=> try { ! return input.readLine() || close(); ! } catch (Throwable t) { ! input.close(); ! throw t; } } ! ! /** ! * Returns the standard temp directory. */ ! File getTempDir() { //There must be a better way? let f = createTempFile("getTempDir", "test"); --- 118,152 ---- } return buff.toString(); ! } ! ! /** ! * Opens a file and returns a generator which yields the lines contained in the file, ! * one by one. ! */ ! void->String readLines(File file, ?String encoding = null) ! requires file.exists(): "File " file " does not exist", ! file.isFile(): file + " is not a normal file. Only normal files can be read." ! { ! let input = new java.io.BufferedReader( (encoding == null) ? new java.io.FileReader(file) : new java.io.InputStreamReader( ! new java.io.FileInputStream(file), encoding) ! ); ! void close() { input.close(); stop(); } ! return ()=> { ! try { ! return input.readLine() || close(); ! } catch (Throwable t) { ! input.close(); ! throw t; } + }; } ! ! /** ! * Returns the standard temp directory. */ ! File getTempDir() { //There must be a better way? let f = createTempFile("getTempDir", "test"); |
From: Daniel B. <bo...@us...> - 2005-03-04 09:48:35
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8992 Modified Files: Makefile Log Message: Fixed some errors in nice.io and end-of-line weirdnesses. Still disable its compilation since some errors remain. Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** Makefile 3 Mar 2005 23:50:03 -0000 1.159 --- Makefile 4 Mar 2005 09:48:17 -0000 1.160 *************** *** 212,216 **** @echo "Building libraries..." $(NICEC1) nice.functional ! $(NICEC1) nice.io testengine: --- 212,216 ---- @echo "Building libraries..." $(NICEC1) nice.functional ! # $(NICEC1) nice.io testengine: |
From: Daniel B. <bo...@us...> - 2005-03-04 02:25:29
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4640/src/bossa/syntax Modified Files: niceclass.nice analyse.nice Log Message: Simplified class initializer resolution by placing 'this' in the SymbolTable used for the initializers instead of fiddling in the parent scope. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** analyse.nice 4 Mar 2005 01:55:19 -0000 1.131 --- analyse.nice 4 Mar 2005 02:25:03 -0000 1.132 *************** *** 21,25 **** // Interface ! Statement analyse(Statement, VarScope, TypeScope, boolean mustReturnAValue); Expression analyse(Expression, VarScope, TypeScope, SymbolTable<VarSymbol> vars = new SymbolTable()); --- 21,26 ---- // Interface ! Statement analyse(Statement, VarScope, TypeScope, boolean mustReturnAValue, ! SymbolTable<VarSymbol> vars = new SymbolTable()); Expression analyse(Expression, VarScope, TypeScope, SymbolTable<VarSymbol> vars = new SymbolTable()); *************** *** 28,32 **** Info buildInfo(VarScope varScope, TypeScope typeScope, ! SymbolTable<VarSymbol> vars = new SymbolTable()) { let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable(); --- 29,33 ---- Info buildInfo(VarScope varScope, TypeScope typeScope, ! SymbolTable<VarSymbol> vars) { let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable(); *************** *** 36,42 **** } ! analyse(Statement s, varScope, typeScope, mustReturnAValue) { ! Info info = buildInfo(varScope, typeScope); analyse(s, info); --- 37,43 ---- } ! analyse(Statement s, varScope, typeScope, mustReturnAValue, vars) { ! Info info = buildInfo(varScope, typeScope, vars); analyse(s, info); *************** *** 51,55 **** MonoSymbol[] params, boolean mustReturnAValue) { ! Info info = buildInfo(varScope, typeScope); info.addVars(params); --- 52,56 ---- MonoSymbol[] params, boolean mustReturnAValue) { ! Info info = buildInfo(varScope, typeScope, new SymbolTable()); info.addVars(params); Index: niceclass.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** niceclass.nice 1 Mar 2005 17:36:36 -0000 1.24 --- niceclass.nice 4 Mar 2005 02:25:03 -0000 1.25 *************** *** 245,249 **** return; - VarScope scope = notNull(definition.scope); mlsub.typing.Monotype thisType = sureMonotype(new mlsub.typing.MonotypeConstructor(definition.getTC(), --- 245,248 ---- *************** *** 252,262 **** Node.thisExp = createSymbolExp(notNull(thisSymbol), definition.location()); ! scope.addSymbol(thisSymbol); for (int i = 0; i < initializers.size(); i++) ! initializers[i] = analyse(initializers[i], notNull(definition.scope), notNull(localScope), false); Node.thisExp = null; - scope.removeSymbol(thisSymbol); } --- 251,266 ---- Node.thisExp = createSymbolExp(notNull(thisSymbol), definition.location()); ! ! SymbolTable<VarSymbol> vars = new SymbolTable(); ! vars["this"] = notNull(thisSymbol); for (int i = 0; i < initializers.size(); i++) ! { ! vars.begin(); ! initializers[i] = analyse(initializers[i], notNull(definition.scope), notNull(localScope), false, vars); ! vars.end(); ! } Node.thisExp = null; } |
From: Daniel B. <bo...@us...> - 2005-03-04 02:25:28
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4640/testsuite/compiler/classes Modified Files: initializer.testsuite Log Message: Simplified class initializer resolution by placing 'this' in the SymbolTable used for the initializers instead of fiddling in the parent scope. Index: initializer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/initializer.testsuite,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** initializer.testsuite 9 Oct 2004 09:41:31 -0000 1.17 --- initializer.testsuite 4 Mar 2005 02:25:02 -0000 1.18 *************** *** 252,253 **** --- 252,267 ---- new A(String s) { this(i: s.length); } + + /// FAIL + let a = new A(); + /// Toplevel + class A + { + { + int i = 1; + } + + { + println(/*/// FAIL HERE */ i); + } + } |
From: Daniel B. <bo...@us...> - 2005-03-04 01:55:31
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28507/src/bossa/syntax Modified Files: contract.nice analyse.nice Log Message: Simplified postcondition resolution by placing 'result' in the SymbolTable used for the expressions instead of the parent. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** analyse.nice 22 Feb 2005 10:27:09 -0000 1.130 --- analyse.nice 4 Mar 2005 01:55:19 -0000 1.131 *************** *** 22,34 **** Statement analyse(Statement, VarScope, TypeScope, boolean mustReturnAValue); ! Expression analyse(Expression, VarScope, TypeScope); // Implementation ! Info buildInfo(VarScope varScope, TypeScope typeScope); ! buildInfo(varScope, typeScope) { let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable(); ! return new Info(vars: new SymbolTable(), typeVars: t, outerVarScope: varScope, outerTypeScope: typeScope, typeMap: new TypeMaper(inner: t, global: typeScope)); --- 22,35 ---- Statement analyse(Statement, VarScope, TypeScope, boolean mustReturnAValue); ! Expression analyse(Expression, VarScope, TypeScope, ! SymbolTable<VarSymbol> vars = new SymbolTable()); // Implementation ! Info buildInfo(VarScope varScope, TypeScope typeScope, ! SymbolTable<VarSymbol> vars = new SymbolTable()) { let SymbolTable<mlsub.typing.TypeSymbol> t = new SymbolTable(); ! return new Info(vars: vars, typeVars: t, outerVarScope: varScope, outerTypeScope: typeScope, typeMap: new TypeMaper(inner: t, global: typeScope)); *************** *** 63,68 **** ! analyse(Expression e, varScope, typeScope) = ! analyse(e, buildInfo(varScope, typeScope)); List<VarSymbol> lookup(VarScope scope, ?LocatedString i) --- 64,69 ---- ! analyse(Expression e, varScope, typeScope, vars) = ! analyse(e, buildInfo(varScope, typeScope, vars)); List<VarSymbol> lookup(VarScope scope, ?LocatedString i) Index: contract.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/contract.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** contract.nice 16 Jan 2005 21:51:15 -0000 1.4 --- contract.nice 4 Mar 2005 01:55:19 -0000 1.5 *************** *** 27,32 **** private StringBuffer ensureRepr = new StringBuffer("ensures "); - private ?MonoSymbol result = null; - public void addElement(Expression condition, ?Expression name, boolean precond) { --- 27,30 ---- *************** *** 58,84 **** } ! void resolve(VarScope scope, TypeScope typeScope, ! mlsub.typing.Monotype resultType, Location location) { ! pre = pre.map(Expression e => analyse(e, scope, typeScope)); if (post.isEmpty()) return; ! if (! nice.tools.typing.Types.isVoid(resultType)) ! result = new ResultMonoSymbol(new LocatedString("result", location), ! type: resultType); ! try { ! if (result != null) ! scope.addSymbol(result); ! post = post.map(Expression e => analyse(e, scope, typeScope)); ! } ! finally { ! if (result != null) ! scope.removeSymbol(result); ! } } --- 56,76 ---- } ! void resolve(VarScope scope, TypeScope typeScope, ! mlsub.typing.Monotype resultType, Location location) { ! pre = pre.map(Expression e => analyse(e, scope, typeScope)); if (post.isEmpty()) return; ! SymbolTable<VarSymbol> vars = new SymbolTable(); ! // Make 'result' a variable in the scope of the post-conditions ! if (! nice.tools.typing.Types.isVoid(resultType)) ! vars["result"] = new ResultMonoSymbol ! (new LocatedString("result", location), type: resultType); ! post = post.map(Expression e => analyse(e, scope, typeScope, vars)); } *************** *** 125,127 **** isAssignable() = false; compile() = gnu.expr.CheckContract.result; ! } \ No newline at end of file --- 117,119 ---- isAssignable() = false; compile() = gnu.expr.CheckContract.result; ! } |
From: Bryn K. <xo...@us...> - 2005-03-03 23:50:34
|
Update of /cvsroot/nice/Nice/stdlib/nice/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28672/stdlib/nice/io Added Files: file.nice Log Message: Some useful odds and ends --- NEW FILE: file.nice --- /**************************************************************************** * N I C E * * A high-level object-oriented research language * * (c) Daniel Bonniot 2003 * * * * This package is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * * * * As a special exception, the copyright holders of this library give you * * permission to link this library with independent modules to produce an * * executable, regardless of the license terms of these independent * * modules, and to copy and distribute the resulting executable under * * terms of your choice. * ****************************************************************************/ /** * Methods for operating on files and directories. * * @author Bryn Keller <xo...@xo...> */ package nice.io; import nice.functional; class File = native java.io.File; /** Path concatenation */ <T> File `/`(File dir, !T file) = new File(dir.getCanonicalPath() + separator + file.toString()); private class NiceFilter implements java.io.FileFilter { File->boolean acceptFunc; accept(file) = acceptFunc(file); } /** * Returns all the files and directories in the given directory. * If the filter function is provided, then only files and * directories for which the filter function returns true will * be included. */ File[] listDir(File dir, File->boolean filter = always(true)) = cast(java.io.File.listFiles(dir, new NiceFilter(acceptFunc: filter))); /** * Traverses a directory structure and returns a preordered * list of all files/directories in * all subdirectories which match the filter. */ void->File traverse(File dir, File->boolean filter = always(true)) requires dir.isDirectory() : "Only directories can be passed to traverse()." { //Explicit stack management, since //Java doesn't do tail call elimination... let stack = new Stack(); var current = dir.listDir(filter).iterator(); return () => { while(!current.hasNext()) { if (stack.isEmpty()) { stop(); } else { current = stack.pop(); } } let f = current.next(); if (f.isDirectory()) { stack.push(current); current = f.listDir(filter).iterator(); } return f; }; } private let String TEST = "This is a test.\nThis is only a test"; /** * Opens a file, writes the given text to it, and closes the file. */ void write(File file, String text, ?String encoding = null) requires file.isFile() : "Only files can be written" { let writer = (encoding == null) ? new java.io.FileWriter(file) : new java.io.OutputStreamWriter( new java.io.FileOutputStream(file), encoding); using(writer) { writer.write(text); } } var int blockSize = 2048; /** * Opens a file and reads the contents into a String. */ String read(File file, ?String encoding = null) requires file.exists(): "File " file " does not exist", file.isFile(): file + " is not a normal file. Only normal files can be read." { let chars = new char[blockSize]; let buff = new StringBuffer(); let input = new BufferedReader( (encoding == null) ? new java.io.FileReader(file) : new java.io.InputStreamReader( new java.io.FileInputStream(file), encoding) ); using(input) { var count = 0; while((count = input.read(chars, 0, blockSize)) > 0) buff.append(chars, 0, count); } return buff.toString(); } /** * Opens a file and returns a generator which yields the lines contained in the file, * one by one. */ void->String readLines(File file, ?encoding = null) requires file.exists(): "File " file " does not exist", file.isFile(): file + " is not a normal file. Only normal files can be read." { let input = new BufferedReader( (encoding == null) ? new java.io.FileReader(file) : new java.io.InputStreamReader( new java.io.FileInputStream(file), encoding) ); void close() { input.close(); stop(); } return ()=> try { return input.readLine() || close(); } catch (Throwable t) { input.close(); throw t; } } /** * Returns the standard temp directory. */ File getTempDir() { //There must be a better way? let f = createTempFile("getTempDir", "test"); let d = f.getParentFile().notNull(); f.delete(); return d; } void _testReadWriteFile() { let f = createTempFile("_testReadWriteFile", ".tmp"); f.write(TEST); let s = f.read(); assert s.equals(TEST); f.delete(); } void _testReadWriteWithEncoding() { let f = createTempFile("_testReadWriteFileWithEncoding", ".tmp"); f.write(TEST, "UTF-16"); let s2 = f.read("UTF-16"); assert s2.equals(TEST); f.delete(); } class DirFixture implements Disposable { List<File> dirs = []; List<File> files = []; { /* one a.txt b.bmp two c.txt three four d.txt */ let tmpdir = getTempDir(); let one = tmpdir/"one"; let two = one/"two"; let three = two/"three"; let four = one/"four"; dirs = [one,two,three,four]; dirs.map(mkdir); let f1 = new File(one, "a.txt"); let f2 = new File(one, "b.bmp"); let f3 = new File(two, "c.txt"); let f4 = new File(four, "d.txt"); files = [f1,f2,f3,f4]; files.map(createNewFile); } dispose() { for(f:files) delete(f); for(f:dirs) delete(f); } } void _testTraverse() { using(new DirFixture()) { let tmpdir = getTempDir(); let gen = traverse(tmpdir/"one"); void test(File file) { let res = gen(); assert res.equals(file) : "Expected " + file + " got " + res; } test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); test(tmpdir/"one"/"two"/"c.txt"); test(tmpdir/"one"/"four"); test(tmpdir/"one"/"four"/"d.txt"); test(tmpdir/"one"/"a.txt"); test(tmpdir/"one"/"b.bmp"); try { gen(); assert false; } catch (GeneratorEnd e) {} } } void _testTraverseWithFilter() { using(new DirFixture()) { let tmpdir = getTempDir(); let gen = traverse(tmpdir/"one", isDirectory); void test(File file) { let res = gen(); assert res.equals(file) : "Expected " + file + " got " + res; } test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); test(tmpdir/"one"/"four"); try { gen(); assert false; } catch (GeneratorEnd e) {} } } void _testTraverseWithFilter2() { using(new DirFixture()) { let tmpdir = getTempDir(); let gen = traverse(tmpdir/"one", File f => f.toString().endsWith(".bmp") || f.isDirectory()); void test(File file) { let res = gen(); assert res.equals(file) : "Expected " + file + " got " + res; } test(tmpdir/"one"/"two"); test(tmpdir/"one"/"two"/"three"); test(tmpdir/"one"/"four"); test(tmpdir/"one"/"b.bmp"); try { gen(); assert false; } catch (GeneratorEnd e) {} } } |
From: Bryn K. <xo...@us...> - 2005-03-03 23:50:15
|
Update of /cvsroot/nice/Nice/stdlib/nice/functional In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28672/stdlib/nice/functional Added Files: higher-order.nice Log Message: Some useful odds and ends --- NEW FILE: higher-order.nice --- /**************************************************************************** * N I C E * * A high-level object-oriented research language * * (c) Daniel Bonniot 2003 * * * * This package is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * * * * As a special exception, the copyright holders of this library give you * * permission to link this library with independent modules to produce an * * executable, regardless of the license terms of these independent * * modules, and to copy and distribute the resulting executable under * * terms of your choice. * ****************************************************************************/ /** * Higher-order functions - that is, functions which take other * functions as arguments, or which return functions. * * @author Bryn Keller <xo...@xo...> */ package nice.functional; /** * Returns a function which returns the opposite of what * the original function would return. */ <T> T->boolean not(T->boolean func) = T t => !func(t); /** * Returns a function which always returns the same result, * no matter what argument it's called with. */ <T,U> U->T always(T constant) = U u => constant; /** * Does nothing, simply returns the object it's passed. */ <T> T id(T thing) = thing; //Tests void _testNot() { let f = int i => i > 1; assert f(2) == true && not(f)(2) == false; } void _testAlways() { let f = always(2); assert f(1) == 2 && f(3) == 2; } void _testID() { let o = new Object(); assert id(o) == o; } |
From: Bryn K. <xo...@us...> - 2005-03-03 23:50:12
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28672 Modified Files: Makefile Log Message: Some useful odds and ends Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** Makefile 16 Feb 2005 16:18:20 -0000 1.158 --- Makefile 3 Mar 2005 23:50:03 -0000 1.159 *************** *** 212,215 **** --- 212,216 ---- @echo "Building libraries..." $(NICEC1) nice.functional + $(NICEC1) nice.io testengine: |
From: Arjan B. <ar...@us...> - 2005-03-01 22:51:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25738/F:/nice/src/bossa/syntax Modified Files: Symbol.java symbol.nice Log Message: Removed workaround for fixed bug. Index: Symbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Symbol.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Symbol.java 14 Jan 2005 22:47:11 -0000 1.2 --- Symbol.java 1 Mar 2005 22:51:12 -0000 1.3 *************** *** 28,33 **** final LocatedString name; - - // commenting this triggers a bug - abstract mlsub.typing.Polytype getType(); } \ No newline at end of file --- 28,30 ---- Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** symbol.nice 21 Feb 2005 19:03:57 -0000 1.13 --- symbol.nice 1 Mar 2005 22:51:12 -0000 1.14 *************** *** 47,52 **** public ?Definition getDefinition() = null; ! // uncommenting this triggers a bug ! // mlsub.typing.Polytype getType(); /** --- 47,51 ---- public ?Definition getDefinition() = null; ! mlsub.typing.Polytype getType(); /** |
From: Daniel B. <bo...@us...> - 2005-03-01 19:25:10
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25943/src/gnu/bytecode Modified Files: ClassType.java Log Message: Don't consider a bytecode method a refinement if it does not have the same return type or a subtype. Index: ClassType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ClassType.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ClassType.java 19 Feb 2004 08:12:37 -0000 1.21 --- ClassType.java 1 Mar 2005 19:24:40 -0000 1.22 *************** *** 738,745 **** { Method res = getMethod(method.getName(), method.arg_types); ! if (res == method) return null; ! else ! return res; } --- 738,748 ---- { Method res = getMethod(method.getName(), method.arg_types); ! ! if (res == method || res == null || ! // A method with a non-subtype return type is not a refinement ! ! res.getReturnType().isSubtype(method.getReturnType())) return null; ! ! return res; } |
From: Daniel B. <bo...@us...> - 2005-03-01 19:24:49
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25943/testsuite/compiler/classes Modified Files: fields.testsuite Log Message: Don't consider a bytecode method a refinement if it does not have the same return type or a subtype. Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/fields.testsuite,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** fields.testsuite 1 Mar 2005 17:40:31 -0000 1.20 --- fields.testsuite 1 Mar 2005 19:24:38 -0000 1.21 *************** *** 183,187 **** {} ! /// PASS bug int x = new B().getFoo(); /// Toplevel --- 183,187 ---- {} ! /// PASS int x = new B().getFoo(); /// Toplevel |
From: Arjan B. <ar...@us...> - 2005-03-01 18:57:16
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/compiler/classes Modified Files: native.testsuite serialization.testsuite this.testsuite typeParameters.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: this.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/this.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** this.testsuite 18 Jan 2004 20:38:40 -0000 1.7 --- this.testsuite 1 Mar 2005 18:56:19 -0000 1.8 *************** *** 112,116 **** } ! getX(this@A) = x; /// PASS --- 112,116 ---- } ! getX(A this) = x; /// PASS Index: serialization.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/serialization.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** serialization.testsuite 3 Dec 2003 21:50:41 -0000 1.5 --- serialization.testsuite 1 Mar 2005 18:56:19 -0000 1.6 *************** *** 77,85 **** } ! writeObject(this@B, out) { out.writeBoolean(true); } ! readObject(this@B, in) { ok = in.readBoolean(); } --- 77,85 ---- } ! writeObject(B this, out) { out.writeBoolean(true); } ! readObject(B this, in) { ok = in.readBoolean(); } Index: typeParameters.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/typeParameters.testsuite,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** typeParameters.testsuite 1 Mar 2005 17:36:35 -0000 1.20 --- typeParameters.testsuite 1 Mar 2005 18:56:19 -0000 1.21 *************** *** 82,86 **** { void play(Number p); ! play(p@Number) { } } --- 82,86 ---- { void play(Number p); ! play(Number p) { } } *************** *** 90,94 **** { void play(Game<S> p); ! play(p@Game) { } } --- 90,94 ---- { void play(Game<S> p); ! play(Game p) { } } *************** *** 171,175 **** class A<T | T <: B, B <: T> extends AbstractSet<T> { } ! add(a@A, b@B) = super; /// PASS bug --- 171,175 ---- class A<T | T <: B, B <: T> extends AbstractSet<T> { } ! add(A a, B b) = super; /// PASS bug *************** *** 178,182 **** class A<T | T <: B, B <: T> extends AbstractSet<T> { } ! add(a@A, b@C) = super; /// PASS --- 178,182 ---- class A<T | T <: B, B <: T> extends AbstractSet<T> { } ! add(A a, C b) = super; /// PASS *************** *** 185,189 **** void do_something( List<A> x ) {} class B<A T | A <: T> extends LinkedList<T> {} ! add(x@B, o) { do_something(x); return super; --- 185,189 ---- void do_something( List<A> x ) {} class B<A T | A <: T> extends LinkedList<T> {} ! add(B x, o) { do_something(x); return super; Index: native.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/native.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** native.testsuite 8 Dec 2004 01:10:27 -0000 1.9 --- native.testsuite 1 Mar 2005 18:56:19 -0000 1.10 *************** *** 3,7 **** /// Toplevel <String T> T m(T); ! m(s@String) = ""; /// PASS --- 3,7 ---- /// Toplevel <String T> T m(T); ! m(String s) = ""; /// PASS |
From: Arjan B. <ar...@us...> - 2005-03-01 18:57:16
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes/constructors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/compiler/classes/constructors Modified Files: compilation.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: compilation.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/constructors/compilation.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** compilation.testsuite 3 Feb 2004 12:09:59 -0000 1.9 --- compilation.testsuite 1 Mar 2005 18:56:19 -0000 1.10 *************** *** 46,50 **** /// Toplevel class B extends A {} ! equals(this@A, that@B) = true; /// PASS --- 46,50 ---- /// Toplevel class B extends A {} ! equals(A this, B that) = true; /// PASS |
From: Arjan B. <ar...@us...> - 2005-03-01 18:57:16
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/compiler/expressions/arrays Modified Files: collection.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: collection.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/arrays/collection.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** collection.testsuite 25 Nov 2002 19:00:40 -0000 1.1 --- collection.testsuite 1 Mar 2005 18:56:20 -0000 1.2 *************** *** 6,10 **** /// Toplevel <T, Collection C> C<T> len(C<T>); ! len(c@Collection) = c; ! len(c@Array) { int i = c.length; return c; } --- 6,10 ---- /// Toplevel <T, Collection C> C<T> len(C<T>); ! len(Collection c) = c; ! len(Array c) { int i = c.length; return c; } |
From: Arjan B. <ar...@us...> - 2005-03-01 18:56:59
|
Update of /cvsroot/nice/Nice/testsuite/compiler/abstractInterfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/compiler/abstractInterfaces Modified Files: existingClass.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: existingClass.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/abstractInterfaces/existingClass.testsuite,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** existingClass.testsuite 21 Nov 2004 16:26:04 -0000 1.10 --- existingClass.testsuite 1 Mar 2005 18:56:18 -0000 1.11 *************** *** 41,45 **** abstract interface I { void f(); } class java.lang.String implements I; ! f(x@String) {} /// PASS --- 41,45 ---- abstract interface I { void f(); } class java.lang.String implements I; ! f(String x) {} /// PASS *************** *** 50,54 **** } class java.io.File finally implements I; ! f(f...@ja...le) = new java.io.File("foo"); /// FAIL --- 50,54 ---- } class java.io.File finally implements I; ! f(java.io.File f) = new java.io.File("foo"); /// FAIL *************** *** 59,63 **** } class java.io.File implements I; ! f(f...@ja...le) = new java.io.File("foo"); /// PASS --- 59,63 ---- } class java.io.File implements I; ! f(java.io.File f) = new java.io.File("foo"); /// PASS |
From: Arjan B. <ar...@us...> - 2005-03-01 18:56:34
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/lib/java/lang Modified Files: comparable.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: comparable.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/java/lang/comparable.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comparable.testsuite 28 Oct 2003 10:36:43 -0000 1.1 --- comparable.testsuite 1 Mar 2005 18:56:23 -0000 1.2 *************** *** 2,5 **** /// Toplevel class A implements java.lang.Comparable { ! compareTo(that@A) = 0; } --- 2,5 ---- /// Toplevel class A implements java.lang.Comparable { ! compareTo(A that) = 0; } |
From: Arjan B. <ar...@us...> - 2005-03-01 18:56:34
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/compiler/methods Modified Files: ambiguity.testsuite boolean.testsuite constrained.testsuite coverage.testsuite globalconstant.testsuite implementations.testsuite integer.testsuite nativeOverride.testsuite nullness.testsuite parameterTypeNaming.testsuite primitive.testsuite super.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: super.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/super.testsuite,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** super.testsuite 7 Oct 2004 22:03:44 -0000 1.14 --- super.testsuite 1 Mar 2005 18:56:21 -0000 1.15 *************** *** 12,17 **** /// Toplevel void m(A); ! m(x@A) {} ! m(x@B) { super; } /// PASS --- 12,17 ---- /// Toplevel void m(A); ! m(A x) {} ! m(B x) { super; } /// PASS *************** *** 19,30 **** /// Toplevel void m(A); ! m(x@B) { super; } ! m(x@A) {} /// PASS /// Toplevel void m(A); ! m(x#A) {} ! m(x@B) { super; } /// PASS --- 19,30 ---- /// Toplevel void m(A); ! m(B x) { super; } ! m(A x) {} /// PASS /// Toplevel void m(A); ! m(#A x) {} ! m(B x) { super; } /// PASS *************** *** 33,38 **** /// Toplevel void m(A); ! m(x@A) { throw new RuntimeException(); } ! m(x@B) { try { --- 33,38 ---- /// Toplevel void m(A); ! m(A x) { throw new RuntimeException(); } ! m(B x) { try { *************** *** 49,55 **** void m(A, A); m(x, y) {} ! m(x@A, y@B) {} ! m(x@B, y@A) {} ! m(x@B, y@B) { /*/// FAIL HERE */ super; } /// PASS --- 49,55 ---- void m(A, A); m(x, y) {} ! m(A x, B y) {} ! m(B x, A y) {} ! m(B x, B y) { /*/// FAIL HERE */ super; } /// PASS *************** *** 71,82 **** String m(A); ! m(a@A) = "A"; ! m(b@B) = super + "->B"; /// PASS assert(new B().toString().endsWith("@A@B")); /// Toplevel ! toString(a@A) = super + "@A"; ! toString(b@B) = super + "@B"; /// FAIL --- 71,82 ---- String m(A); ! m(A a) = "A"; ! m(B b) = super + "->B"; /// PASS assert(new B().toString().endsWith("@A@B")); /// Toplevel ! toString(A a) = super + "@A"; ! toString(B b) = super + "@B"; /// FAIL *************** *** 85,90 **** <A T> T m(T); ! m(a#A) = new A(); ! m(b@B) = super; /// FAIL --- 85,90 ---- <A T> T m(T); ! m(#A a) = new A(); ! m(B b) = super; /// FAIL *************** *** 122,130 **** /// Toplevel void m(A); ! m(a@A) {} /// package b import a /// Toplevel ! m(b@B) { super; } /// PASS --- 122,130 ---- /// Toplevel void m(A); ! m(A a) {} /// package b import a /// Toplevel ! m(B b) { super; } /// PASS *************** *** 133,141 **** /// Toplevel void m(A); ! m(@A) { if (false) m(new A()); } /// package b import a /// Toplevel ! m(@B) { super; } /// PASS --- 133,141 ---- /// Toplevel void m(A); ! m(A x) { if (false) m(new A()); } /// package b import a /// Toplevel ! m(B x) { super; } /// PASS *************** *** 143,152 **** /// package a import b /// Toplevel ! m(@B) { super; } /// package b import a /// Toplevel void m(A); ! m(@A) { if (false) m(new A()); } /// PASS --- 143,152 ---- /// package a import b /// Toplevel ! m(B x) { super; } /// package b import a /// Toplevel void m(A); ! m(A x) { if (false) m(new A()); } /// PASS *************** *** 174,179 **** abstract class D extends C {} ! equals(x@C, y@D) = true; ! equals(x@D, y@C) = true; --- 174,179 ---- abstract class D extends C {} ! equals(C x, D y) = true; ! equals(D x, C y) = true; *************** *** 182,186 **** abstract class E extends D { ! equals(x@D) = /*/// FAIL HERE */ super; // This is ambiguous. } --- 182,186 ---- abstract class E extends D { ! equals(D x) = /*/// FAIL HERE */ super; // This is ambiguous. } *************** *** 214,218 **** abstract class A<B> extends AbstractSet<B> { } ! add(a@A, b) = super; /// PASS --- 214,218 ---- abstract class A<B> extends AbstractSet<B> { } ! add(A a, b) = super; /// PASS *************** *** 224,229 **** abstract class A<T> extends AbstractSet<T> { T x; } ! add(a@A, b) = false; ! add(a@A, b@B) = super; /// PASS --- 224,229 ---- abstract class A<T> extends AbstractSet<T> { T x; } ! add(A a, b) = false; ! add(A a, B b) = super; /// PASS *************** *** 245,249 **** class M { int f(A); ! f(b@B) = super; f(a) = 1; } --- 245,249 ---- class M { int f(A); ! f(B b) = super; f(a) = 1; } Index: integer.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/integer.testsuite,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** integer.testsuite 17 Jan 2005 18:26:12 -0000 1.16 --- integer.testsuite 1 Mar 2005 18:56:21 -0000 1.17 *************** *** 2,6 **** /// Toplevel long fac(long n); ! fac(n@long) = n*fac(n-1); fac(1) = 1; --- 2,6 ---- /// Toplevel long fac(long n); ! fac(long n) = n*fac(n-1); fac(1) = 1; *************** *** 8,12 **** /// Toplevel int fib(int n); ! fib(n@int) = fib(n-2) + fib(n-1); fib(1) = 1; fib(2) = 1; --- 8,12 ---- /// Toplevel int fib(int n); ! fib(int n) = fib(n-2) + fib(n-1); fib(1) = 1; fib(2) = 1; *************** *** 16,22 **** int ack(int x, int y); // missing (0,0) case ! ack(0, y@int) = y+1; ! ack(x@int, 0) = ack(x-1, 1); ! ack(x@int, y@int) = ack(x-1, ack(x, y-1)); --- 16,22 ---- int ack(int x, int y); // missing (0,0) case ! ack(0, int y) = y+1; ! ack(int x, 0) = ack(x-1, 1); ! ack(int x, int y) = ack(x-1, ack(x, y-1)); *************** *** 24,28 **** /// Toplevel String toStr(char); ! toStr(@char) = ""; toStr('a') = "a"; toStr('b') = "b"; --- 24,28 ---- /// Toplevel String toStr(char); ! toStr(char x) = ""; toStr('a') = "a"; toStr('b') = "b"; *************** *** 34,38 **** /// Toplevel int bar(int); ! bar(n@int) = n; bar(-1) = 1; bar(-12389) = 12389; --- 34,38 ---- /// Toplevel int bar(int); ! bar(int n) = n; bar(-1) = 1; bar(-12389) = 12389; *************** *** 46,50 **** /// Toplevel boolean foo(char); ! foo(@char) = false; foo('\1') = true; foo('\3') = false; --- 46,50 ---- /// Toplevel boolean foo(char); ! foo(char x) = false; foo('\1') = true; foo('\3') = false; *************** *** 69,73 **** /// Toplevel String toStr(char); ! toStr(c@char) = ""; toStr('a') = "a"; toStr('b') = "b"; --- 69,73 ---- /// Toplevel String toStr(char); ! toStr(char x) = ""; toStr('a') = "a"; toStr('b') = "b"; *************** *** 76,95 **** /// Toplevel void foo(long); ! foo(@long) {} ! foo(@int) {} /// FAIL /// Toplevel void foo(long); ! foo(@long) {} ! foo(#int) {} /// PASS /// Toplevel String getStr(int i, String str); ! getStr(0, str@String) = "no "+str; ! getStr(1, str@String) = "one "+str; ! getStr(2, str@String) = "many "+str; ! getStr(i, str@String) = "unknown code"; /// PASS --- 76,95 ---- /// Toplevel void foo(long); ! foo(long n) {} ! foo(int n) {} /// FAIL /// Toplevel void foo(long); ! foo(long n) {} ! foo(#int n) {} /// PASS /// Toplevel String getStr(int i, String str); ! getStr(0, String str) = "no "+str; ! getStr(1, String str) = "one "+str; ! getStr(2, String str) = "many "+str; ! getStr(i, String str) = "unknown code"; /// PASS Index: coverage.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/coverage.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** coverage.testsuite 17 Jan 2005 18:26:12 -0000 1.5 --- coverage.testsuite 1 Mar 2005 18:56:21 -0000 1.6 *************** *** 12,16 **** class nice.lang.boolean implements I; ! fooI(b1@boolean, b2@boolean) = b1; class A implements I { --- 12,16 ---- class nice.lang.boolean implements I; ! fooI(boolean b1, boolean b2) = b1; class A implements I { Index: nativeOverride.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/nativeOverride.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nativeOverride.testsuite 2 Feb 2004 13:08:32 -0000 1.9 --- nativeOverride.testsuite 1 Mar 2005 18:56:21 -0000 1.10 *************** *** 30,34 **** int x; ! equals(that@A) = this.x == that.x; } --- 30,34 ---- int x; ! equals(A that) = this.x == that.x; } *************** *** 44,48 **** int x; ! equals(that@B) = this.x == that.x; } --- 44,48 ---- int x; ! equals(B that) = this.x == that.x; } *************** *** 52,56 **** /// Toplevel class A { ! equals(that@A) = true; } --- 52,56 ---- /// Toplevel class A { ! equals(A that) = true; } *************** *** 59,63 **** int x; ! equals(that@B) = this.x == that.x; } --- 59,63 ---- int x; ! equals(B that) = this.x == that.x; } *************** *** 72,77 **** int x; ! equals(that@A) = this.x == that.x; ! equals(that@B) = this.x == that.x && that.y == 0; } --- 72,77 ---- int x; ! equals(A that) = this.x == that.x; ! equals(B that) = this.x == that.x && that.y == 0; } *************** *** 80,84 **** int y; ! equals(that@B) = this.x == that.x && this.y == that.y; } --- 80,84 ---- int y; ! equals(B that) = this.x == that.x && this.y == that.y; } *************** *** 90,94 **** int x; ! equals(that@A) = this.x == that.x; } --- 90,94 ---- int x; ! equals(A that) = this.x == that.x; } *************** *** 104,108 **** equals(that) = false; ! equals(that@A) = this.x == that.x; } --- 104,108 ---- equals(that) = false; ! equals(A that) = this.x == that.x; } *************** *** 117,121 **** int x; ! equals(that@A) = this.x == that.x; } --- 117,121 ---- int x; ! equals(A that) = this.x == that.x; } *************** *** 125,132 **** class B extends A { ! equals(that@A) = super; } ! equals(this@A, that@B) = false; ! equals(this@B, that@B) = true; /// PASS --- 125,132 ---- class B extends A { ! equals(A that) = super; } ! equals(A this, B that) = false; ! equals(B this, B that) = true; /// PASS *************** *** 137,141 **** int x; ! equals(that@A) = this.x == that.x; } --- 137,141 ---- int x; ! equals(A that) = this.x == that.x; } *************** *** 147,151 **** /// FAIL ///Toplevel ! /*/// FAIL HERE */ toString(s@String) = ""; /// FAIL --- 147,151 ---- /// FAIL ///Toplevel ! /*/// FAIL HERE */ toString(String s) = ""; /// FAIL *************** *** 154,163 **** class A { ! equals(that@B) = false; } class B extends A { ! equals(that@A) = true; } --- 154,163 ---- class A { ! equals(B that) = false; } class B extends A { ! equals(A that) = true; } *************** *** 189,193 **** /// FAIL interface I{} ! equals(x@I,y@I) = true; /// PASS --- 189,193 ---- /// FAIL interface I{} ! equals(I x, I y) = true; /// PASS *************** *** 207,211 **** class Bar<T> extends AbstractList<T> { ! removeAll(other@Bar) = false; size() = 0; --- 207,211 ---- class Bar<T> extends AbstractList<T> { ! removeAll(Bar other) = false; size() = 0; Index: ambiguity.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/ambiguity.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ambiguity.testsuite 17 Jan 2005 18:26:10 -0000 1.5 --- ambiguity.testsuite 1 Mar 2005 18:56:21 -0000 1.6 *************** *** 4,9 **** void /*/// FAIL HERE */ f(A); ! f(x@A) {} ! f(x@A) {} /// PASS --- 4,9 ---- void /*/// FAIL HERE */ f(A); ! f(A x) {} ! f(A x) {} /// PASS Index: nullness.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/nullness.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nullness.testsuite 25 May 2003 11:13:22 -0000 1.2 --- nullness.testsuite 1 Mar 2005 18:56:21 -0000 1.3 *************** *** 2,6 **** /// Toplevel void m(?String); ! m(@String) {} /// PASS --- 2,6 ---- /// Toplevel void m(?String); ! m(String x) {} /// PASS *************** *** 9,13 **** /// Toplevel boolean foo(?String); ! foo(#String) = true; foo(null) = false; --- 9,13 ---- /// Toplevel boolean foo(?String); ! foo(#String x) = true; foo(null) = false; *************** *** 18,20 **** boolean foo(?String); foo(null) = false; ! foo(#String) = true; --- 18,20 ---- boolean foo(?String); foo(null) = false; ! foo(#String x) = true; Index: primitive.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/primitive.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** primitive.testsuite 19 Dec 2003 02:12:34 -0000 1.5 --- primitive.testsuite 1 Mar 2005 18:56:21 -0000 1.6 *************** *** 1,10 **** /// FAIL ///Toplevel ! toString(/*/// FAIL HERE */ i@int) = ""; /// FAIL ///Toplevel <T> void foo(!T) {} ! foo(/*/// FAIL HERE */ i@int) {} /// FAIL --- 1,10 ---- /// FAIL ///Toplevel ! toString(/*/// FAIL HERE */ int i) = ""; /// FAIL ///Toplevel <T> void foo(!T) {} ! foo(/*/// FAIL HERE */ int i) {} /// FAIL Index: implementations.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/implementations.testsuite,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** implementations.testsuite 19 Dec 2004 00:09:50 -0000 1.18 --- implementations.testsuite 1 Mar 2005 18:56:21 -0000 1.19 *************** *** 21,25 **** class C extends A { ! // It is OK not to implement m(@C,_), since X has no concrete instance. } --- 21,25 ---- class C extends A { ! // It is OK not to implement m(C x,_), since X has no concrete instance. } *************** *** 58,62 **** class B<T> implements A<T> { B<T> bfield; } ! doSomething(b@B) { b.bfield; } /// FAIL --- 58,62 ---- class B<T> implements A<T> { B<T> bfield; } ! doSomething(B b) { b.bfield; } /// FAIL *************** *** 65,69 **** void paint(java.awt.Graphics g); } ! paint(p...@ja...ponent, g) { (notNull (g)).drawString("I love java", 20, 20); } --- 65,69 ---- void paint(java.awt.Graphics g); } ! paint(java.awt.Component p, g) { (notNull (g)).drawString("I love java", 20, 20); } *************** *** 74,78 **** void foo(I); ! foo(#I){} /// FAIL --- 74,78 ---- void foo(I); ! foo(#I x){} /// FAIL *************** *** 81,85 **** void foo(X); ! foo(#X){} /// FAIL --- 81,85 ---- void foo(X); ! foo(#X x){} /// FAIL *************** *** 88,93 **** class B extends A{} ! void foo(B); ! foo(@A){} /// PASS --- 88,93 ---- class B extends A{} ! void foo(B x); ! foo(A x){} /// PASS *************** *** 101,106 **** } <T> A<T> j(A<A<T>>); ! j(b@B) = new B(cons: j(b.cons)); ! j(c@C) = new C(cons: j(c.cons)); /// FAIL --- 101,106 ---- } <T> A<T> j(A<A<T>>); ! j(B b) = new B(cons: j(b.cons)); ! j(C c) = new C(cons: j(c.cons)); /// FAIL *************** *** 119,123 **** class A { int i; } int f(?A); ! f(x@A) = x.i; f(null) = 0; --- 119,123 ---- class A { int i; } int f(?A); ! f(A x) = x.i; f(null) = 0; Index: parameterTypeNaming.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/parameterTypeNaming.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** parameterTypeNaming.testsuite 8 Dec 2003 19:46:09 -0000 1.4 --- parameterTypeNaming.testsuite 1 Mar 2005 18:56:21 -0000 1.5 *************** *** 11,15 **** foo(#A x) = x; ! <T> bar(x@B : X) { X /*/// FAIL HERE*/ res = foo(x); --- 11,15 ---- foo(#A x) = x; ! <T> bar(B:X x) { X /*/// FAIL HERE*/ res = foo(x); *************** *** 21,25 **** void bug() {} } ! foo(#B) = new A(); /// PASS bug --- 21,25 ---- void bug() {} } ! foo(#B x) = new A(); /// PASS bug *************** *** 27,31 **** <Collection C, T, U> C<U> bar(C<T>, T->U); bar(x, f) { throw new Error(); } ! <C,T,U> bar(l@List : L, f) { L<U> res = similarEmptyCollection(l); --- 27,31 ---- <Collection C, T, U> C<U> bar(C<T>, T->U); bar(x, f) { throw new Error(); } ! <C,T,U> bar(List:L l, f) { L<U> res = similarEmptyCollection(l); *************** *** 50,54 **** foo(a) = a; ! <T> foo(b@B : X) { X copy = b.foo(); String useB = copy.b; --- 50,54 ---- foo(a) = a; ! <T> foo(B:X b) { X copy = b.foo(); String useB = copy.b; Index: constrained.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/constrained.testsuite,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** constrained.testsuite 15 Sep 2004 00:47:31 -0000 1.6 --- constrained.testsuite 1 Mar 2005 18:56:21 -0000 1.7 *************** *** 47,51 **** void foo(I<A>, I<B>); ! foo(@Y,@Y) {} // @X,@Y is missing --- 47,51 ---- void foo(I<A>, I<B>); ! foo(Y a, Y b) {} // @X,@Y is missing *************** *** 61,66 **** void foo(I<A>, I<B>); ! foo(@Y,@Y) {} ! foo(@X,@Y) {} /// FAIL --- 61,66 ---- void foo(I<A>, I<B>); ! foo(Y a, Y b) {} ! foo(X a, Y b) {} /// FAIL Index: globalconstant.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/globalconstant.testsuite,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** globalconstant.testsuite 7 Aug 2004 14:20:28 -0000 1.10 --- globalconstant.testsuite 1 Mar 2005 18:56:21 -0000 1.11 *************** *** 4,8 **** let int TWO = 2; int fib(int n); ! fib(n@int) = fib(n-2) + fib(n-1); fib(ONE) = 1; fib(TWO) = 1; --- 4,8 ---- let int TWO = 2; int fib(int n); ! fib(int n) = fib(n-2) + fib(n-1); fib(ONE) = 1; fib(TWO) = 1; Index: boolean.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/boolean.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** boolean.testsuite 25 Feb 2003 19:52:37 -0000 1.2 --- boolean.testsuite 1 Mar 2005 18:56:21 -0000 1.3 *************** *** 5,9 **** /// Toplevel boolean not(boolean); ! not(b@boolean) = !b; /// PASS --- 5,9 ---- /// Toplevel boolean not(boolean); ! not(boolean b) = !b; /// PASS *************** *** 15,19 **** /// Toplevel boolean and(boolean, boolean); ! and(@boolean, @boolean) = false; and(true, true) = true; --- 15,19 ---- /// Toplevel boolean and(boolean, boolean); ! and(boolean a, boolean b) = false; and(true, true) = true; *************** *** 28,35 **** /// FAIL /// Toplevel ! boolean or(boolean, boolean); // Ambiguity for the case (@true, @true) ! or(@true, @boolean) = true; ! or(boolean, true) = true; or(false, false) = false; --- 28,35 ---- /// FAIL /// Toplevel ! boolean or(a, b); // Ambiguity for the case (@true, @true) ! or(true, boolean b) = true; ! or(boolean a, true) = true; or(false, false) = false; |
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/compiler/typing Modified Files: abstractInterfaces.testsuite alike.testsuite coverage.testsuite final.testsuite matching.testsuite null.testsuite polymorphism.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: matching.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/matching.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** matching.testsuite 29 Aug 2003 16:08:11 -0000 1.2 --- matching.testsuite 1 Mar 2005 18:56:23 -0000 1.3 *************** *** 6,12 **** } ! f(x@M) = x; ! f(x#M) = new M(); /// PASS --- 6,12 ---- } ! f(M x) = x; ! f(#M x) = new M(); /// PASS *************** *** 21,25 **** ! addTo(this@Packet, queue) { var next = queue; --- 21,25 ---- ! addTo(Packet this, queue) { var next = queue; Index: final.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/final.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** final.testsuite 13 Oct 2004 18:28:51 -0000 1.2 --- final.testsuite 1 Mar 2005 18:56:23 -0000 1.3 *************** *** 7,9 **** ff(x) = x; ! ff(x@F2) = new F2(); --- 7,9 ---- ff(x) = x; ! ff(F2 x) = new F2(); Index: coverage.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/coverage.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** coverage.testsuite 14 Oct 2004 20:35:34 -0000 1.3 --- coverage.testsuite 1 Mar 2005 18:56:23 -0000 1.4 *************** *** 22,26 **** /// TOPLEVEL void method3(String); ! method3(f@String) {} // this case is mandatory to cover method3 method3(/*/// FAIL HERE */null) {} --- 22,26 ---- /// TOPLEVEL void method3(String); ! method3(String f) {} // this case is mandatory to cover method3 method3(/*/// FAIL HERE */null) {} Index: null.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/null.testsuite,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** null.testsuite 13 Oct 2004 18:28:51 -0000 1.9 --- null.testsuite 1 Mar 2005 18:56:23 -0000 1.10 *************** *** 52,56 **** } ! <R,A> call(this@OOMemoize, a){ if (this.table.containsKey(a)) return notNull(this.table.get(a)); --- 52,56 ---- } ! <R,A> call(OOMemoize this, a){ if (this.table.containsKey(a)) return notNull(this.table.get(a)); Index: abstractInterfaces.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/abstractInterfaces.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** abstractInterfaces.testsuite 2 Jun 2003 17:43:10 -0000 1.4 --- abstractInterfaces.testsuite 1 Mar 2005 18:56:22 -0000 1.5 *************** *** 26,30 **** } class A finally implements I {} ! f(x@A) = new A(); /// FAIL --- 26,30 ---- } class A finally implements I {} ! f(A x) = new A(); /// FAIL *************** *** 37,41 **** } class A implements I {} ! f(x@A) = new A(); /// PASS --- 37,41 ---- } class A implements I {} ! f(A x) = new A(); /// PASS *************** *** 47,51 **** abstract class A finally implements I {} class B extends A {} ! f(x@B) { A res = new B(); return res; } /// PASS --- 47,51 ---- abstract class A finally implements I {} class B extends A {} ! f(B x) { A res = new B(); return res; } /// PASS *************** *** 74,78 **** var B b = new X(); ! foo(x@X) = b; /// PASS --- 74,78 ---- var B b = new X(); ! foo(X x) = b; /// PASS *************** *** 94,97 **** <I1 T | T : I2> T f(T); f(x) = x; ! f(x@C) = new A(); --- 94,97 ---- <I1 T | T : I2> T f(T); f(x) = x; ! f(C x) = new A(); Index: alike.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/alike.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** alike.testsuite 18 Dec 2004 17:37:31 -0000 1.2 --- alike.testsuite 1 Mar 2005 18:56:23 -0000 1.3 *************** *** 9,16 **** {} ! f1(x@A) = x; <A T> T f2(T); ! f2(x@A) = x.f1(); /// PASS --- 9,16 ---- {} ! f1(A x) = x; <A T> T f2(T); ! f2(A x) = x.f1(); /// PASS *************** *** 21,25 **** } ! f4(x@C, y) { f4(x, y); --- 21,25 ---- } ! f4(C x, y) { f4(x, y); Index: polymorphism.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/polymorphism.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** polymorphism.testsuite 13 Oct 2004 18:28:51 -0000 1.5 --- polymorphism.testsuite 1 Mar 2005 18:56:23 -0000 1.6 *************** *** 20,24 **** <T> int m(T); m(x) = 0; ! m(c@Collection) = c.size(); /// PASS --- 20,24 ---- <T> int m(T); m(x) = 0; ! m(Collection c) = c.size(); /// PASS |
From: Arjan B. <ar...@us...> - 2005-03-01 18:56:33
|
Update of /cvsroot/nice/Nice/testsuite/lib/java/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17429/F:/nice/testsuite/lib/java/util Modified Files: collections.testsuite Log Message: Removed deprecated pattern syntax from testsuite. Index: collections.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/java/util/collections.testsuite,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** collections.testsuite 15 Jan 2004 21:39:20 -0000 1.13 --- collections.testsuite 1 Mar 2005 18:56:23 -0000 1.14 *************** *** 60,64 **** <T,U,V | U <: T, V <: T> Set<T> myintersection(Set<U>, Set<V>); ! <T,U,V> myintersection(s1@Set, s2@Set) { Set<T> res = new HashSet(); if (s1.size() < s2.size()) { --- 60,64 ---- <T,U,V | U <: T, V <: T> Set<T> myintersection(Set<U>, Set<V>); ! <T,U,V> myintersection(Set s1, Set s2) { Set<T> res = new HashSet(); if (s1.size() < s2.size()) { |