nice-commit Mailing List for The Nice Programming Language (Page 86)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@us...> - 2003-08-29 17:41:50
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv29077/testsuite/compiler/methods Modified Files: super.testsuite Log Message: Call the correct super implementation when an implemented interface also declared the method. Index: super.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/super.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** super.testsuite 10 Jun 2003 09:35:39 -0000 1.7 --- super.testsuite 29 Aug 2003 17:41:45 -0000 1.8 *************** *** 217,218 **** --- 217,229 ---- add(a@A, b) = false; add(a@A, b@B) = super; + + /// PASS bug + new Bar().isEmpty(); + /// Toplevel + class Bar<T> extends AbstractList<T> + { + isEmpty() = super; + + size() = 0; + get(i) = cast(null); + } |
From: <bo...@us...> - 2003-08-29 16:52:48
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv18313/src/bossa/syntax Modified Files: TypeConstructors.java RetypedJavaMethod.java JavaClasses.java Log Message: Avoid ambiguity with constructors that are retyped. Index: TypeConstructors.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeConstructors.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TypeConstructors.java 8 Feb 2003 16:40:19 -0000 1.10 --- TypeConstructors.java 29 Aug 2003 16:52:42 -0000 1.11 *************** *** 55,58 **** --- 55,67 ---- } + static void removeConstructor(TypeConstructor tc, MethodDeclaration m) + { + List l = (List) constructors.get(tc); + if (l == null) + return; + + l.remove(m.getSymbol()); + } + private static HashMap constructors; public static void reset() { constructors = new HashMap(); } Index: RetypedJavaMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RetypedJavaMethod.java 24 Jun 2003 10:00:41 -0000 1.6 --- RetypedJavaMethod.java 29 Aug 2003 16:52:42 -0000 1.7 *************** *** 171,176 **** "\nFound : " + reflectMethod.return_type.getName()); - JavaClasses.registerNativeMethod(this, reflectMethod); - if (reflectMethod.isConstructor()) { --- 171,174 ---- *************** *** 178,186 **** mlsub.typing.TypeConstructor tc = Types.typeConstructor(holder); if (tc != null) ! TypeConstructors.addConstructor(tc, this); } catch(Types.NotIntroducedClassException ex) {} } ! int javaArity; if(reflectMethod.getStaticFlag() || reflectMethod.isConstructor()) --- 176,189 ---- mlsub.typing.TypeConstructor tc = Types.typeConstructor(holder); if (tc != null) ! { ! TypeConstructors.addConstructor(tc, this); ! JavaClasses.registerNativeConstructor(this, reflectMethod, tc); ! } } catch(Types.NotIntroducedClassException ex) {} } ! else ! JavaClasses.registerNativeMethod(this, reflectMethod); ! int javaArity; if(reflectMethod.getStaticFlag() || reflectMethod.isConstructor()) Index: JavaClasses.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/JavaClasses.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** JavaClasses.java 7 Aug 2003 10:20:23 -0000 1.35 --- JavaClasses.java 29 Aug 2003 16:52:42 -0000 1.36 *************** *** 212,216 **** /* If auto is a RetypedJavaMethod, we are explicitely declaring two ! methods forthe same native method. This is useful to give it several incomparable types. Otherwise, auto is an implicit java method, and we discard it --- 212,216 ---- /* If auto is a RetypedJavaMethod, we are explicitely declaring two ! methods for the same native method. This is useful to give it several incomparable types. Otherwise, auto is an implicit java method, and we discard it *************** *** 221,224 **** --- 221,241 ---- } + static void registerNativeConstructor(RetypedJavaMethod m, + Method reflectMethod, + TypeConstructor classe) + { + MethodDeclaration auto = (MethodDeclaration) retyped.put(reflectMethod, m); + /* + If auto is a RetypedJavaMethod, we are explicitely declaring two + constructors for the same native constructor. + This is useful to give it several + incomparable types. + Otherwise, auto is an implicit java constructor, and we discard it + in favor of the new explicit one. + */ + if (auto != null && ! (auto instanceof RetypedJavaMethod)) + TypeConstructors.removeConstructor(classe, auto); + } + static void registerNativeField(JavaFieldAccess f, Field reflectField) { *************** *** 230,234 **** private static void removeFromScope(MethodDeclaration m) { ! Node.getGlobalScope().removeSymbol(m.getSymbol()); } --- 247,251 ---- private static void removeFromScope(MethodDeclaration m) { ! Node.getGlobalScope().removeSymbol(m.getSymbol()); } *************** *** 301,335 **** addSymbol(f, JavaFieldAccess.make(f)); ! for (Method m = classType.getMethods(); m!=null; m = m.getNext()) ! if(m.isConstructor()) ! { ! JavaMethod res = JavaMethod.make(m, true); ! if (res != null) ! TypeConstructors.addConstructor(tc, res); ! else if(Debug.javaTypes) ! Debug.println("Constructor " + m + " ignored"); ! } ! else ! { ! /* We don't need to put static methods in the global scope. ! They can and must be access by specifying the class explicitely, ! like in Java. ! */ ! if (m.getStaticFlag()) ! continue; ! Method base = baseMethod(classType, m); ! if (base != null) ! continue; ! // Ignore the method if it is explicitely retyped ! if (retyped.get(m) == null) ! { ! if (Debug.javaTypes) ! Debug.println("Loaded native method " + m); ! addSymbol(m, JavaMethod.make(m, false)); ! } ! } } catch(NoClassDefFoundError e){ --- 318,357 ---- addSymbol(f, JavaFieldAccess.make(f)); ! for (Method m = classType.getMethods(); m != null; m = m.getNext()) ! { ! // Ignore the method if it is explicitely retyped ! if (retyped.get(m) != null) ! continue; ! if (m.isConstructor()) ! { ! JavaMethod res = JavaMethod.make(m, true); ! if (res != null) ! { ! TypeConstructors.addConstructor(tc, res); ! retyped.put(m, res); ! } ! else if(Debug.javaTypes) ! Debug.println("Constructor " + m + " ignored"); ! } ! else ! { ! /* We don't need to put static methods in the global scope. ! They can and must be accessed by specifying the class ! explicitely, like in Java. ! */ ! if (m.getStaticFlag()) ! continue; ! Method base = baseMethod(classType, m); ! if (base != null) ! continue; ! ! if (Debug.javaTypes) ! Debug.println("Loaded native method " + m); ! addSymbol(m, JavaMethod.make(m, false)); ! } ! } } catch(NoClassDefFoundError e){ |
From: <bo...@us...> - 2003-08-29 16:08:15
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv8372/debian Modified Files: changelog Log Message: Method parameters that are not dispatched on get their declared type. This avoids some type errors, and simplifies error messages. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.203 retrieving revision 1.204 diff -C2 -d -r1.203 -r1.204 *** changelog 28 Aug 2003 08:46:32 -0000 1.203 --- changelog 29 Aug 2003 16:08:12 -0000 1.204 *************** *** 12,15 **** --- 12,17 ---- * Floating point literals are now of type double by default, adding 'f' or 'F' at the end will make them of type float. + * Method parameters that are not dispatched on simply get their declared + type. This avoids some type errors, and simplifies error messages. * Bugfixes (incrementation of byte local variables, require a default value for global variables, ...) |
From: <bo...@us...> - 2003-08-29 16:08:15
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv8372/src/bossa/syntax Modified Files: MethodBodyDefinition.java Log Message: Method parameters that are not dispatched on get their declared type. This avoids some type errors, and simplifies error messages. Index: MethodBodyDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodBodyDefinition.java,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** MethodBodyDefinition.java 26 Aug 2003 16:07:58 -0000 1.139 --- MethodBodyDefinition.java 29 Aug 2003 16:08:11 -0000 1.140 *************** *** 105,109 **** Monotype type; ! if (p.getRuntimeTC() != null) { AtomicKind v = p.tc.variance; --- 105,115 ---- Monotype type; ! if (p.atAny()) ! { ! // When a parameter is not dispatched on, it has the declared type ! // of that parameter in the method declaration. ! type = types[tn]; ! } ! else if (p.getRuntimeTC() != null) { AtomicKind v = p.tc.variance; |
From: <bo...@us...> - 2003-08-29 16:08:14
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv8372/testsuite/compiler/typing Modified Files: matching.testsuite Log Message: Method parameters that are not dispatched on get their declared type. This avoids some type errors, and simplifies error messages. Index: matching.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/matching.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** matching.testsuite 25 Jun 2002 07:06:05 -0000 1.1 --- matching.testsuite 29 Aug 2003 16:08:11 -0000 1.2 *************** *** 9,10 **** --- 9,27 ---- f(x#M) = new M(); + + /// PASS + /// Toplevel + let Packet NO_PACKET = new Packet(); + + class Packet { + private Packet link = NO_PACKET; + + void addTo(Packet); + } + + + addTo(this@Packet, queue) + { + var next = queue; + next = next.link; + } |
From: <ar...@us...> - 2003-08-29 15:38:29
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv2521/F:/nice/stdlib/nice/lang Modified Files: collections.nice numeric.nice Log Message: A few more methods for the stdlib. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** collections.nice 24 Aug 2003 20:47:57 -0000 1.52 --- collections.nice 29 Aug 2003 15:38:21 -0000 1.53 *************** *** 361,364 **** --- 361,390 ---- } + <T> void reversefor(List<T> list, T->void func) + { + let it = list.listIterator(list.size()); + while(it.hasPrevious()) + func(it.previous()); + } + + <T, U> List<U> reversemap(List<T> list, T->U func) + { + List<U> res = new ArrayList(list.size); + let it = list.listIterator(list.size()); + while(it.hasPrevious()) + res.add(func(it.previous())); + + return res; + } + + <T,U | T <: U> List<U> flatten(List<List<T>> list) + { + List<U> res = new ArrayList(); + for (elem : list) + res.addAll(elem); + + return res; + } + /**************************************************************** * toArray Index: numeric.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/numeric.nice,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** numeric.nice 21 Jul 2003 17:24:14 -0000 1.31 --- numeric.nice 29 Aug 2003 15:38:21 -0000 1.32 *************** *** 209,212 **** --- 209,216 ---- int min(int , int ) = native int Math.min(int , int ); + double abs(double) = native double Math.abs(double); + float abs(float ) = native float Math.abs(float ); + long abs(long ) = native long Math.abs(long ); + int abs(int ) = native int Math.abs(int ); // Comparable interface *************** *** 232,233 **** --- 236,255 ---- double `**`(double, double) = native double Math.pow(double, double); + + long gcd(long a, long b) requires a!=0 || b!=0 : "gcd(0,0) undefined" + { + long rem = a % b; + long tmp = b; + while (rem > 0) + (tmp, rem) = (rem, tmp % rem); + + return tmp; + } + + long lcm(long a, long b) + { + if (a==0 || b==0) + return 0; + + return abs((a / gcd(a,b)) * b); + } |
From: <bo...@us...> - 2003-08-29 14:07:44
|
Update of /cvsroot/nice/Nice/regtest/basic In directory sc8-pr-cvs1:/tmp/cvs-serv16744/regtest/basic Modified Files: arrays.nice Log Message: Avoid clash with Collections.reverse. Index: arrays.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/arrays.nice,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** arrays.nice 25 Aug 2003 23:43:36 -0000 1.22 --- arrays.nice 29 Aug 2003 14:07:39 -0000 1.23 *************** *** 13,17 **** } ! <Any T> Array<T> reverse(Array<T>); /* this is an interesting case to keep: dispatch on Array for a method that only accepts (polymorphic) arrays. --- 13,17 ---- } ! <Any T> Array<T> rev(Array<T>); /* this is an interesting case to keep: dispatch on Array for a method that only accepts (polymorphic) arrays. *************** *** 19,23 **** while it would be rawArray if the domain of the method was bigger. */ ! <T> reverse(a@Array) { T[] res = fill(new T[a.length], int i => a[a.length - i - 1]); --- 19,23 ---- while it would be rawArray if the domain of the method was bigger. */ ! <T> rev(a@Array) { T[] res = fill(new T[a.length], int i => a[a.length - i - 1]); *************** *** 32,36 **** int[] a = test_native_arrays(); p(a); ! p(reverse(a)); test_collection_arrays(a); test_polymorphism(); --- 32,36 ---- int[] a = test_native_arrays(); p(a); ! p(rev(a)); test_collection_arrays(a); test_polymorphism(); *************** *** 94,98 **** int[] b = map(a, int i => i+4); p(b); ! p(filter(reverse(b), int i=> i>6)); long[] ls = map(a, id); --- 94,98 ---- int[] b = map(a, int i => i+4); p(b); ! p(filter(rev(b), int i=> i>6)); long[] ls = map(a, id); |
From: <ar...@us...> - 2003-08-29 13:45:13
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv12797/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: retypings for the class methods of java.util. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** java.nice 28 Aug 2003 22:51:06 -0000 1.28 --- java.nice 29 Aug 2003 13:45:08 -0000 1.29 *************** *** 145,148 **** --- 145,174 ---- <K,V> V setValue(Map.Entry<K,V>, V) = native Object Map.Entry.setValue(Object); + <T> void ensureCapacity(ArrayList<T>, int) = native void ArrayList.ensureCapacity(int); + <T> void trimToSize(ArrayList<T>) = native void ArrayList.trimToSize(); + <T> void addFirst(LinkedList<T>, T) = native void LinkedList.addFirst(Object); + <T> void addLast(LinkedList<T>, T) = native void LinkedList.addLast(Object); + <T> T getFirst(LinkedList<T>) = native Object LinkedList.getFirst(); + <T> T getLast(LinkedList<T>) = native Object LinkedList.getLast(); + <T> T removeFirst(LinkedList<T>) = native Object LinkedList.removeFirst(); + <T> T removeLast(LinkedList<T>) = native Object LinkedList.removeLast(); + <T> boolean empty(Stack<T>) = native boolean Stack.empty(); + <T> T peek(Stack<T>) = native Object Stack.peek(); + <T> T pop(Stack<T>) = native Object Stack.pop(); + <T> T push(Stack<T>, T) = native Object Stack.push(Object); + <T,U | T <: U> int search(Stack<T>, U) = native int Stack.search(Object); + <T> void addElement(Vector<T>, T) = native void Vector.addElement(Object); + <T> int capacity(Vector<T>) = native int Vector.capacity(); + <T,U | T <: U> void copyInto(Vector<T>, U[]) = native void Vector.copyInto(Object[]); + <T> T elementAt(Vector<T>, int) = native Object Vector.elementAt(int); + <T> T firstElement(Vector<T>) = native Object Vector.firstElement(); + <T> T lastElement(Vector<T>) = native Object Vector.lastElement(); + <T> boolean removeElement(Vector<T>, T) = native boolean Vector.removeElement(Object); + <T> void removeElementAt(Vector<T>, int) = native void Vector.removeElementAt(int); + <T> void setElementAt(Vector<T>, T, int) = native void Vector.setElementAt(Object, int); + <T> void insertElementAt(Vector<T>, T, int) = native void Vector.insertElementAt(Object, int); + <T> void setSize(Vector<T>,int) = native void Vector.setSize(int); + <T> void trimToSize(Vector<T>) = native void Vector.trimToSize(); + <T> void removeAllElements(Vector<T>) = native void Vector.removeAllElements(); <T> Iterator<T> iterator(Collection<T>) = *************** *** 209,213 **** <K, V, V0 | V <: V0> java.util.Collection<V0> values(java.util.Map<K, V>) = native java.util.Collection java.util.Map.values(); ! <K, K0, V, V0 | K <: K0, V <: V0> java.util.Set<java.util.Map.Entry<K0, V0>> entrySet(java.util.Map<K, V>) = native java.util.Set java.util.Map.entrySet(); <K, V, V0 | V <: V0> boolean contains(java.util.Hashtable<K,V>, V0) = --- 235,239 ---- <K, V, V0 | V <: V0> java.util.Collection<V0> values(java.util.Map<K, V>) = native java.util.Collection java.util.Map.values(); ! <K, V> java.util.Set<java.util.Map.Entry<K, V>> entrySet(java.util.Map<K, V>) = native java.util.Set java.util.Map.entrySet(); <K, V, V0 | V <: V0> boolean contains(java.util.Hashtable<K,V>, V0) = |
From: <ar...@us...> - 2003-08-28 22:51:09
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv11907/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: retypings for the interface of java.util. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** java.nice 27 Aug 2003 15:42:08 -0000 1.27 --- java.nice 28 Aug 2003 22:51:06 -0000 1.28 *************** *** 103,106 **** --- 103,149 ---- // PACKAGE: java.util + <T> boolean add(Collection<T>, T) = native boolean Collection.add(Object); + <T> void clear(Collection<T>) = native void Collection.clear(); + <T> boolean isEmpty(Collection<T>) = native boolean Collection.isEmpty(); + <T> int size(Collection<T>) = native int Collection.size(); + <T,U | T <: U> U[] toArray(Collection<T>) = native Object[] Collection.toArray(); + <T,U,V | T <: ?V, ?V <: ?U > ?U[] toArray(Collection<T>, ?V[]) = native Object[] Collection.toArray(Object[]); + + <T> void add(List<T>, int, T) = native void List.add(int, Object); + <T> T get(List<T>, int) = native Object List.get(int); + <T> T set(List<T>, int, T) = native Object List.set(int, Object); + <T> List<T> subList(List<T>, int, int) = native List List.subList(int, int); + + <T> boolean hasNext(Iterator<T>) = native boolean Iterator.hasNext(); + <T> T next(Iterator<T>) = native Object Iterator.next(); + <T> void remove(Iterator<T>) = native void Iterator.remove(); + <T,U | U <: T> void add(ListIterator<T>, U) = native void ListIterator.add(Object); + <T> boolean hasPrevious(ListIterator<T>) = native boolean ListIterator.hasPrevious(); + <T> int nextIndex(ListIterator<T>) = native int ListIterator.nextIndex(); + <T> T previous(ListIterator<T>) = native Object ListIterator.previous(); + <T> int previousIndex(ListIterator<T>) = native int ListIterator.previousIndex(); + <T,U | U <: T> void set(ListIterator<T>, U) = native void ListIterator.set(Object); + <T> int compare(Comparator<T>, T, T) = native int Comparator.compare(Object, Object); + <T,U | U <: T> ?Comparator<U> comparator(SortedSet<T>) = native Comparator SortedSet.comparator(); + <T> T first(SortedSet<T>) = native Object SortedSet.first(); + <T> T last(SortedSet<T>) = native Object SortedSet.last(); + <T,U | T <: U> SortedSet<T> headSet(SortedSet<T>, U) = native SortedSet SortedSet.headSet(Object); + <T,U | T <: U> SortedSet<T> tailSet(SortedSet<T>, U) = native SortedSet SortedSet.tailSet(Object); + <T,U,V | T <: U, T <: V> SortedSet<T> subSet(SortedSet<T>, U, V) = native SortedSet SortedSet.subSet(Object, Object); + + <K,V> void clear(Map<K,V>) = native void Map.clear(); + <K,V> boolean isEmpty(Map<K,V>) = native boolean Map.isEmpty(); + <K,V> int size(Map<K,V>) = native int Map.size(); + <K,V,T | K <: T> ?Comparator<T> comparator(SortedMap<K,V>) = native Comparator SortedMap.comparator(); + <K,V> K firstKey(SortedMap<K,V>) = native Object SortedMap.firstKey(); + <K,V> K lastKey(SortedMap<K,V>) = native Object SortedMap.lastKey(); + <K,V,L | K <: L> SortedMap<K,V> headMap(SortedMap<K,V>, L) = native SortedMap SortedMap.headMap(Object); + <K,V,L | K <: L> SortedMap<K,V> tailMap(SortedMap<K,V>, L) = native SortedMap SortedMap.tailMap(Object); + <K,V,L,M | K <: L, K <: M> SortedMap<K,V> subMap(SortedMap<K,V>, L, M) = native SortedMap SortedMap.subMap(Object, Object); + <K,V> K getKey(Map.Entry<K,V>) = native Object Map.Entry.getKey(); + <K,V> V getValue(Map.Entry<K,V>) = native Object Map.Entry.getValue(); + <K,V> V setValue(Map.Entry<K,V>, V) = native Object Map.Entry.setValue(Object); + + <T> Iterator<T> iterator(Collection<T>) = native Iterator Collection.iterator(); |
From: <ar...@us...> - 2003-08-28 17:46:24
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv14527/F:/nice/stdlib/nice/lang Modified Files: ForInIters.nice Added Files: range.nice Log Message: Added a simple range class. --- NEW FILE: range.nice --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2003 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package nice.lang; public class Range<T | T <: int, int <: T> extends AbstractList<T> { private final int begin; private final int end; isEmpty() = false; size() = 1+end-begin; get(index) { if (index < 0 || index >= 1+end-begin) throw new IndexOutOfBoundsException(); return begin + index; } add(elem) = throw new UnsupportedOperationException(); contains(elem) = begin <= cast(elem) <= end; iterator() = new RangeIterator(range: this, pos: begin-1); listIterator() = new RangeIterator(range: this, pos: begin-1); listIterator(index) = new RangeIterator(range: this, pos: begin + index-1); } public class RangeIterator<T | T <: int, int <: T> implements ListIterator<T> { final Range<int> range; int pos; hasNext() = pos+1 <= range.end; next() = ++pos; hasPrevious() = pos-1 >= range.begin; previous() = --pos; nextIndex() = (pos-range.begin) + 1; previousIndex() = pos - range.begin; remove() = throw new UnsupportedOperationException(); set(elem) = throw new UnsupportedOperationException(); add(elem) = throw new UnsupportedOperationException(); } public Range<int> `..`(int begin, int end) requires begin <= end { return new Range(begin: begin, end: end); } Index: ForInIters.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/ForInIters.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ForInIters.nice 21 Jul 2003 17:24:14 -0000 1.4 --- ForInIters.nice 28 Aug 2003 17:46:15 -0000 1.5 *************** *** 20,23 **** --- 20,24 ---- Iterator<char> forIterator(String s) = new StringForIterator(str: s); Iterator<char> forIterator(StringBuffer sb) = new StringBufferForIterator(strb: sb); + Iterator<int> forIterator(Range<int> range) = range.iterator(); //The implementations of additional Iterators |
From: <ar...@us...> - 2003-08-28 17:46:19
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/loops In directory sc8-pr-cvs1:/tmp/cvs-serv14527/F:/nice/testsuite/compiler/statements/loops Modified Files: newforloop.testsuite Log Message: Added a simple range class. Index: newforloop.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/loops/newforloop.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** newforloop.testsuite 9 Aug 2003 10:51:47 -0000 1.2 --- newforloop.testsuite 28 Aug 2003 17:46:15 -0000 1.3 *************** *** 42,43 **** --- 42,49 ---- for(i : array3) j+=i; assert(j==10); + + /// PASS + int sum = 0; + for(x : 1..10) + sum += x; + assert(sum==55); |
From: <ar...@us...> - 2003-08-28 17:46:19
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv14527/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Added a simple range class. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -d -r1.204 -r1.205 *** Parser.jj 22 Aug 2003 13:36:40 -0000 1.204 --- Parser.jj 28 Aug 2003 17:46:14 -0000 1.205 *************** *** 241,245 **** { < FLOATING_POINT_LITERAL: ! (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])? | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])? | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])? --- 241,245 ---- { < FLOATING_POINT_LITERAL: ! (["0"-"9"])+ "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])? | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])? | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])? |
From: <bo...@us...> - 2003-08-28 15:56:45
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv26789/src/bossa/link Modified Files: Compilation.java Log Message: Call the correct super method in a Nice implementation of a Java method, when both an implemented interface and a superclass of the superclass provide the method. Index: Compilation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Compilation.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Compilation.java 18 Apr 2003 14:50:29 -0000 1.11 --- Compilation.java 28 Aug 2003 15:56:42 -0000 1.12 *************** *** 178,182 **** ClassType superClass = c.getSuperclass(); gnu.bytecode.Method superMethod = superClass.getMethod ! (m.getName().toString(), m.javaArgTypes()); if (superMethod != null) return new ApplyExp --- 178,182 ---- ClassType superClass = c.getSuperclass(); gnu.bytecode.Method superMethod = superClass.getMethod ! (m.getName().toString(), m.javaArgTypes(), true); if (superMethod != null) return new ApplyExp |
From: <bo...@us...> - 2003-08-28 12:46:41
|
Update of /cvsroot/nice/Nice/src/gnu/bytecode In directory sc8-pr-cvs1:/tmp/cvs-serv22580/src/gnu/bytecode Modified Files: ClassType.java Log Message: Call the correct super method in a Nice implementation of a Java method, when both an implemented interface and a superclass of the superclass provide the method. Index: ClassType.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/bytecode/ClassType.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ClassType.java 9 Aug 2003 21:01:51 -0000 1.16 --- ClassType.java 28 Aug 2003 12:46:37 -0000 1.17 *************** *** 593,596 **** --- 593,604 ---- public Method getMethod(String name, Type[] arg_types) { + return getMethod(name, arg_types, false); + } + + /** + @concrete whether only a concrete (non-interface) method is desired. + */ + public Method getMethod(String name, Type[] arg_types, boolean concrete) + { ClassType cl = this; for (;;) *************** *** 600,611 **** return method; ! ClassType[] interfaces = cl.getInterfaces(); ! if (interfaces != null) ! for (int i = 0; i < interfaces.length; i++) ! { ! method = interfaces[i].getMethod(name, arg_types); ! if (method != null) ! return method; ! } cl = cl.getSuperclass(); --- 608,622 ---- return method; ! if (! concrete) ! { ! ClassType[] interfaces = cl.getInterfaces(); ! if (interfaces != null) ! for (int i = 0; i < interfaces.length; i++) ! { ! method = interfaces[i].getMethod(name, arg_types); ! if (method != null) ! return method; ! } ! } cl = cl.getSuperclass(); |
From: <bo...@us...> - 2003-08-28 12:46:41
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv22580/testsuite/compiler/methods Modified Files: nativeOverride.testsuite Log Message: Call the correct super method in a Nice implementation of a Java method, when both an implemented interface and a superclass of the superclass provide the method. Index: nativeOverride.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/nativeOverride.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nativeOverride.testsuite 23 Apr 2003 19:56:58 -0000 1.4 --- nativeOverride.testsuite 28 Aug 2003 12:46:37 -0000 1.5 *************** *** 190,191 **** --- 190,207 ---- interface I{} equals(x@I,y@I) = true; + + /// PASS + Collection<String> b = new Bar(); + /// Toplevel + class Bar<T> extends AbstractList<T> + { + isEmpty() = false; + } + + /// PASS bug + Collection<String> b = new Bar(); + /// Toplevel + class Bar<T> extends AbstractList<T> + { + removeAll(other@Bar) = false; + } |
From: <bo...@us...> - 2003-08-28 08:46:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv20751/src/bossa/syntax Modified Files: typecheck.nice analyse.nice MonoSymbol.java Log Message: Allow assignments to local variables whose type was dynamically inferred after an instanceof. We now use the same scheme as for null tests, since that is more powerful in handling branches. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** typecheck.nice 22 Aug 2003 13:36:41 -0000 1.74 --- typecheck.nice 28 Aug 2003 08:46:32 -0000 1.75 *************** *** 47,61 **** catch(TypingEx t){ ?MonoSymbol variable = localVariable(to); ! if (variable != null) ! if (hasConditionalType(variable) && isNullError(t)) { try { ! let unsureType = makeUnsure(variable.type); ! checkAssignment(new mlsub.typing.Polytype(unsureType), notNull(e.value)); ! // It is OK to assign the variable with a null value. ! variable.setVarType(now: unsureType, otherBranch: variable.type, ! overrideOut: unsureType); return; } --- 47,62 ---- catch(TypingEx t){ ?MonoSymbol variable = localVariable(to); ! if (variable != null) { ! let originalType = getOriginalType(variable); ! if (originalType != null) try { ! checkAssignment(new mlsub.typing.Polytype(originalType), notNull(e.value)); ! // It is OK to assign the variable, considering it has the original ! // type. ! variable.setVarType(now: originalType, otherBranch: variable.type, ! overrideOut: originalType); return; } *************** *** 357,360 **** --- 358,372 ---- } + ?mlsub.typing.Monotype getOriginalType(MonoSymbol variable) + { + for (int i = 0; i < levels.size(); i++) + { + (MonoSymbol v, mlsub.typing.Monotype t) = conditionalTypes.get(i); + if (variable == v) + return t; + } + return null; + } + typecheck(e@IfExp) { *************** *** 379,382 **** --- 391,417 ---- setVarType(variable, now: sureType, otherBranch: type); }); + + ?(MonoSymbol, TypeConstructor) test = getInstanceof(e); + if (test != null) + { + (MonoSymbol variable, TypeConstructor tc) = test; + mlsub.typing.Monotype[?] parameters = null; + if (tc.arity() == 0) + parameters = null; + else if (variable.getMonotype() instanceof mlsub.typing.MonotypeConstructor) + { + mlsub.typing.MonotypeConstructor mc = cast(variable.getMonotype()); + parameters = mc.getTP(); + } + else + test = null; + + if (test != null) + { + mlsub.typing.Monotype type = Monotype.sure(new mlsub.typing.MonotypeConstructor(tc, parameters)); + setVarType(variable, now: type, otherBranch: variable.type); + } + } + e.thenExp = thenExp = notNull(thenExp.noOverloading()); Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** analyse.nice 27 Aug 2003 09:33:45 -0000 1.80 --- analyse.nice 28 Aug 2003 08:46:32 -0000 1.81 *************** *** 174,178 **** } ! void addVar(MonoSymbol symbol, boolean redefining = false) { ?Monotype type = symbol.syntacticType; --- 174,178 ---- } ! void addVar(MonoSymbol symbol) { ?Monotype type = symbol.syntacticType; *************** *** 183,188 **** throw error(symbol, "A variable cannot have a void type"); } ! if (! redefining) ! this.checkNotDefined(symbol); this.vars[symbol.name.toString()] = symbol; } --- 183,187 ---- throw error(symbol, "A variable cannot have a void type"); } ! this.checkNotDefined(symbol); this.vars[symbol.name.toString()] = symbol; } *************** *** 480,512 **** info.beginCases(); - ?(MonoSymbol, TypeConstructor) test = getInstanceof(e); - - if (test != null) - { - (MonoSymbol variable, TypeConstructor tc) = test; - mlsub.typing.Monotype[?] parameters = null; - if (tc.arity() == 0) - parameters = null; - else if (variable.getMonotype() instanceof mlsub.typing.MonotypeConstructor) - { - mlsub.typing.MonotypeConstructor mc = cast(variable.getMonotype()); - parameters = mc.getTP(); - } - else - test = null; - - if (test != null) - { - mlsub.typing.Monotype type = Monotype.sure(new mlsub.typing.MonotypeConstructor(tc, parameters)); - info.begin(); - info.addVar(MonoSymbol.mock(variable, type), redefining: true); - } - } - e.thenExp = analyse(e.thenExp, info); e.thenUnreachable = info.getUnreachable(); - - if (test != null) - info.end(); info.otherCase(); --- 479,484 ---- Index: MonoSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MonoSymbol.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** MonoSymbol.java 27 Aug 2003 09:33:45 -0000 1.23 --- MonoSymbol.java 28 Aug 2003 08:46:32 -0000 1.24 *************** *** 161,178 **** Monotype syntacticType; mlsub.typing.Monotype type; - - /**************************************************************** - * Using a symbol instead of another when a more precise type is known. - ****************************************************************/ - - static MonoSymbol mock(final MonoSymbol origin, mlsub.typing.Monotype type) - { - return new MonoSymbol(origin.getName(), type) - { - gnu.expr.Declaration getDeclaration() - { - return origin.getDeclaration(); - } - }; - } } --- 161,163 ---- |
From: <bo...@us...> - 2003-08-28 08:46:35
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv20751/debian Modified Files: changelog Log Message: Allow assignments to local variables whose type was dynamically inferred after an instanceof. We now use the same scheme as for null tests, since that is more powerful in handling branches. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.202 retrieving revision 1.203 diff -C2 -d -r1.202 -r1.203 *** changelog 26 Aug 2003 21:55:25 -0000 1.202 --- changelog 28 Aug 2003 08:46:32 -0000 1.203 *************** *** 1,4 **** --- 1,9 ---- nice (0.9.2) unstable; urgency=low + * More dynamic type inference implemented. The type of a local variable is + made more precise after a succesful instanceof: + A a = ...; + if (a instanceof B) + // Here a has type B * Classes that implement java.lang.Cloneable now automatically support the clone method. |
From: <bo...@us...> - 2003-08-28 08:46:35
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv20751/testsuite/compiler/typing Modified Files: instanceof.testsuite Log Message: Allow assignments to local variables whose type was dynamically inferred after an instanceof. We now use the same scheme as for null tests, since that is more powerful in handling branches. Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/instanceof.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** instanceof.testsuite 27 Aug 2003 09:33:45 -0000 1.1 --- instanceof.testsuite 28 Aug 2003 08:46:32 -0000 1.2 *************** *** 25,26 **** --- 25,57 ---- ; assert a.life == 42; + + /// PASS + A a; + a = new B(); + if (a instanceof B) + ; + else + throw new Error(); + assert a.life == 42; + + /// COMMENT Assignments. + /// PASS + A a = new B(); + if (a instanceof B) + { + int i = a.life; + if (i == 42) + a = new A(); + else + i = a.life + 1; + } + + /// FAIL + A a = new B(); + if (a instanceof B) + { + int i = a.life; + if (i == 42) + a = new A(); + i = a.life; + } |
From: <ar...@us...> - 2003-08-27 15:42:12
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv2936/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: A few more retypings of java.util. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** java.nice 28 Jul 2003 19:42:23 -0000 1.26 --- java.nice 27 Aug 2003 15:42:08 -0000 1.27 *************** *** 171,174 **** --- 171,178 ---- native boolean java.util.Hashtable.contains(Object); + //make map[key] = value; possible + <K, V0, V | V <: ?V0> ?V0 set(java.util.Map<K, V>, K, V)= + native Object java.util.Map.put(Object, Object); + //rename Dictionary methods causing ambiguity in Hashtable <K, V> V _put(java.util.Dictionary<K, V>, K, V)= *************** *** 179,182 **** --- 183,196 ---- native boolean java.util.Dictionary.isEmpty(); + //static collections methods + <T> void fill(List<T>, T) = native void Collections.fill(List, Object); + <T> void reverse(List<T>) = native void Collections.reverse(List); + <T> void shuffle(List<T>) = native void Collections.shuffle(List); + <T> void shuffle(List<T>, Random) = + native void Collections.shuffle(List, Random); + <T,U | T <: U> T max(Collection<T>, Comparator<U>) = + native Object Collections.max(Collection, Comparator); + <T,U | T <: U> T min(Collection<T>, Comparator<U>) = + native Object Collections.max(Collection, Comparator); <T,U,V | U <: T, V <: T> boolean Arrays_equals(U[], V[]) = |
From: <bo...@us...> - 2003-08-27 09:35:43
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv4936/web Modified Files: new.xsl Log Message: Added link to the getting started wiki page. Index: new.xsl =================================================================== RCS file: /cvsroot/nice/Nice/web/new.xsl,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** new.xsl 9 Aug 2003 21:44:35 -0000 1.12 --- new.xsl 27 Aug 2003 09:35:39 -0000 1.13 *************** *** 92,95 **** --- 92,98 ---- <br /> <span class="small">o</span><xsl:text> </xsl:text> + <a class="nav" href="/cgi-bin/twiki/view/Doc/QuickIntroduction">Getting started</a> + <br /> + <span class="small">o</span><xsl:text> </xsl:text> <a class="nav" href="compilation.html">Using the compiler</a> <br /> |
From: <bo...@us...> - 2003-08-27 09:35:09
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler/console In directory sc8-pr-cvs1:/tmp/cvs-serv4846/src/nice/tools/compiler/console Modified Files: main.nice Log Message: Added link to the compiler usage page. Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/console/main.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.nice 24 Jun 2003 09:16:43 -0000 1.3 --- main.nice 27 Aug 2003 09:35:06 -0000 1.4 *************** *** 57,61 **** shortDescription: "compiler for the Nice programming language", author: "Daniel Bonniot <bo...@us...>, <Dan...@in...>", ! seeAlso: "http://nice.sourceforge.net the Nice Home Page\n", manualSection: "1", arguments: "package", options: cast(null)); --- 57,62 ---- shortDescription: "compiler for the Nice programming language", author: "Daniel Bonniot <bo...@us...>, <Dan...@in...>", ! seeAlso: "http://nice.sourceforge.net the Nice Home Page\n" + ! "http://nice.sf.net/compilation.html compilation instructions\n", manualSection: "1", arguments: "package", options: cast(null)); |
From: <bo...@us...> - 2003-08-27 09:33:49
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv4636/src/bossa/syntax Modified Files: tools.nice analyse.nice TypeConstantExp.java MonoSymbol.java Log Message: Dynamic type inference for instanceof. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tools.nice 27 May 2003 21:07:53 -0000 1.22 --- tools.nice 27 Aug 2003 09:33:45 -0000 1.23 *************** *** 93,96 **** --- 93,126 ---- } + ?(MonoSymbol, TypeConstructor) getInstanceof(IfExp ifExp) + { + if (! (ifExp.condition instanceof CallExp)) + return null; + + CallExp condition = cast(ifExp.condition); + if (! condition.isCallTo("instanceof") || condition.arguments.size() != 2) + return null; + + Expression arg1 = condition.arguments.getExp(0); + if (! (arg1 instanceof SymbolExp)) + return null; + + SymbolExp symExp = cast(arg1); + if (! (symExp.getSymbol() instanceof MonoSymbol)) + return null; + + MonoSymbol sym = cast(symExp.getSymbol()); + + Expression arg2 = condition.arguments.getExp(1); + if (! (arg2 instanceof TypeConstantExp)) + return null; + + TypeConstantExp type = cast(arg2); + if (type.representedType == null) + return null; + + return (sym, notNull(type.representedType)); + } + /**************************************************************** * Temporary: this should be solved when AST classes are written Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** analyse.nice 24 Aug 2003 18:09:53 -0000 1.79 --- analyse.nice 27 Aug 2003 09:33:45 -0000 1.80 *************** *** 174,178 **** } ! void addVar(MonoSymbol symbol) { ?Monotype type = symbol.syntacticType; --- 174,178 ---- } ! void addVar(MonoSymbol symbol, boolean redefining = false) { ?Monotype type = symbol.syntacticType; *************** *** 183,187 **** throw error(symbol, "A variable cannot have a void type"); } ! this.checkNotDefined(symbol); this.vars[symbol.name.toString()] = symbol; } --- 183,188 ---- throw error(symbol, "A variable cannot have a void type"); } ! if (! redefining) ! this.checkNotDefined(symbol); this.vars[symbol.name.toString()] = symbol; } *************** *** 478,484 **** --- 479,513 ---- info.beginCases(); + + ?(MonoSymbol, TypeConstructor) test = getInstanceof(e); + + if (test != null) + { + (MonoSymbol variable, TypeConstructor tc) = test; + mlsub.typing.Monotype[?] parameters = null; + if (tc.arity() == 0) + parameters = null; + else if (variable.getMonotype() instanceof mlsub.typing.MonotypeConstructor) + { + mlsub.typing.MonotypeConstructor mc = cast(variable.getMonotype()); + parameters = mc.getTP(); + } + else + test = null; + + if (test != null) + { + mlsub.typing.Monotype type = Monotype.sure(new mlsub.typing.MonotypeConstructor(tc, parameters)); + info.begin(); + info.addVar(MonoSymbol.mock(variable, type), redefining: true); + } + } + e.thenExp = analyse(e.thenExp, info); e.thenUnreachable = info.getUnreachable(); + if (test != null) + info.end(); + info.otherCase(); e.elseExp = analyse(e.elseExp, info); *************** *** 555,558 **** --- 584,589 ---- e.value = object(type); + e.representedType = bossa.syntax.Node.getGlobalTypeScope(). + globalLookup(name.toString(), name.location()); return e; Index: TypeConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TypeConstantExp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TypeConstantExp.java 21 Aug 2002 18:20:31 -0000 1.2 --- TypeConstantExp.java 27 Aug 2003 09:33:45 -0000 1.3 *************** *** 26,28 **** --- 26,30 ---- super(PrimitiveType.typeTC, name, name.toString(), name.location()); } + + mlsub.typing.TypeConstructor representedType; } Index: MonoSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MonoSymbol.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** MonoSymbol.java 26 Jul 2003 22:29:47 -0000 1.22 --- MonoSymbol.java 27 Aug 2003 09:33:45 -0000 1.23 *************** *** 161,163 **** --- 161,178 ---- Monotype syntacticType; mlsub.typing.Monotype type; + + /**************************************************************** + * Using a symbol instead of another when a more precise type is known. + ****************************************************************/ + + static MonoSymbol mock(final MonoSymbol origin, mlsub.typing.Monotype type) + { + return new MonoSymbol(origin.getName(), type) + { + gnu.expr.Declaration getDeclaration() + { + return origin.getDeclaration(); + } + }; + } } |
From: <bo...@us...> - 2003-08-27 09:33:49
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv4636/testsuite/compiler/typing Added Files: instanceof.testsuite Log Message: Dynamic type inference for instanceof. --- NEW FILE: instanceof.testsuite --- /// global class A{} class B extends A { int life = 42; } /// PASS A a; a = new B(); if (a instanceof B) assert a.life == 42; else assert false; /// FAIL A a; a = new A(); if (a instanceof B) assert false; else assert a.life == 42; /// FAIL A a; a = new B(); if (a instanceof B) ; assert a.life == 42; |
From: <ar...@us...> - 2003-08-26 22:30:50
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv11569/F:/nice/debian Modified Files: changelog Log Message: update of changelog. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.201 retrieving revision 1.202 diff -C2 -d -r1.201 -r1.202 *** changelog 26 Aug 2003 16:07:58 -0000 1.201 --- changelog 26 Aug 2003 21:55:25 -0000 1.202 *************** *** 5,9 **** * The deprecated 'main(args) { ... }' syntax for the main function is not supported anymore. Please use instead: 'void main(String[] args) { ... }' ! * Bugfixes (incrementation of byte local variables, ...) -- --- 5,12 ---- * The deprecated 'main(args) { ... }' syntax for the main function is not supported anymore. Please use instead: 'void main(String[] args) { ... }' ! * Floating point literals are now of type double by default, adding ! 'f' or 'F' at the end will make them of type float. ! * Bugfixes (incrementation of byte local variables, require a default value ! for global variables, ...) -- |
From: <bo...@us...> - 2003-08-26 16:08:05
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv13534/debian Modified Files: changelog Log Message: The deprecated 'main(args) { ... }' syntax for the main function is not supported anymore. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** changelog 26 Aug 2003 00:45:13 -0000 1.200 --- changelog 26 Aug 2003 16:07:58 -0000 1.201 *************** *** 3,6 **** --- 3,8 ---- * Classes that implement java.lang.Cloneable now automatically support the clone method. + * The deprecated 'main(args) { ... }' syntax for the main function is not + supported anymore. Please use instead: 'void main(String[] args) { ... }' * Bugfixes (incrementation of byte local variables, ...) |