[Nice-commit] Nice/regtest/basic optionalParameters.nice,1.9,1.10 null.nice,1.12,1.13 native.nice,1.
Brought to you by:
bonniot
Update of /cvsroot/nice/Nice/regtest/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3107/regtest/basic Modified Files: optionalParameters.nice null.nice native.nice main.nice higherOrder.nice functions.nice exceptions.nice classes.nice arrays.nice Log Message: Removed the Any keyword. Index: higherOrder.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/higherOrder.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** higherOrder.nice 20 Feb 2003 11:16:14 -0000 1.8 --- higherOrder.nice 14 Oct 2004 20:50:09 -0000 1.9 *************** *** 3,9 **** /** Tests higher order functions */ ! <Any T, Any U> U apply(T->U f, T x) = f(x); ! <Any T, Any U> U apply2(T->U f, T x); apply2(f, x) = f(x); --- 3,9 ---- /** Tests higher order functions */ ! <T, U> U apply(T->U f, T x) = f(x); ! <T, U> U apply2(T->U f, T x); apply2(f, x) = f(x); *************** *** 26,31 **** { println(id("ID")); ! println((<Any T>(T x)=>x)("LAMBDA")); ! println(apply(<Any T>(T x)=>x, "LAMBDA")); println(apply(nativeToString, "Using native methods as first class values")); println(apply(id(intIdentity), 42)); --- 26,31 ---- { println(id("ID")); ! println((<T>(T x)=>x)("LAMBDA")); ! println(apply(<T>(T x)=>x, "LAMBDA")); println(apply(nativeToString, "Using native methods as first class values")); println(apply(id(intIdentity), 42)); Index: functions.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/functions.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** functions.nice 1 May 2002 21:13:26 -0000 1.7 --- functions.nice 14 Oct 2004 20:50:09 -0000 1.8 *************** *** 28,32 **** // Function with a parametric type ! <Any T> T identity(T x) = x; // anonymous argument is ok --- 28,32 ---- // Function with a parametric type ! <T> T identity(T x) = x; // anonymous argument is ok Index: arrays.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/arrays.nice,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** arrays.nice 17 Jan 2004 16:38:42 -0000 1.24 --- arrays.nice 14 Oct 2004 20:50:09 -0000 1.25 *************** *** 4,8 **** // Array<T> and T[] are synonyms ! <Any T> void p(Array<T>); p(a) { --- 4,8 ---- // Array<T> and T[] are synonyms ! <T> void p(Array<T>); p(a) { *************** *** 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. --- 13,17 ---- } ! <T> Array<T> rev(Array<T>); /* this is an interesting case to keep: dispatch on Array for a method that only accepts (polymorphic) arrays. *************** *** 163,171 **** // We test how functions on polymorphic arrays deal with native type components ! <Any T> T getFirst(T[] a) = a[0]; // Use a polymorphic array as a collection after losing its type // because of bytecode types' monomorphicity. ! <Any T> void polyArrayAsCollection(T[] a) { a = id(a).map(id); } class V<T> --- 163,171 ---- // We test how functions on polymorphic arrays deal with native type components ! <T> T getFirst(T[] a) = a[0]; // Use a polymorphic array as a collection after losing its type // because of bytecode types' monomorphicity. ! <T> void polyArrayAsCollection(T[] a) { a = id(a).map(id); } class V<T> *************** *** 174,178 **** } ! <Any T> V<T> makeV() = new V(elements: cast(new T[1])); void test_polymorphism() --- 174,178 ---- } ! <T> V<T> makeV() = new V(elements: cast(new T[1])); void test_polymorphism() *************** *** 237,242 **** } ! <Any T> ?Array<T> arrayId(?Array<T> a) = id(a); // Using array -> Collection implicit conversion in the returned value ! <Any T> Collection<T> wrap(T x) = [ x ]; --- 237,242 ---- } ! <T> ?Array<T> arrayId(?Array<T> a) = id(a); // Using array -> Collection implicit conversion in the returned value ! <T> Collection<T> wrap(T x) = [ x ]; Index: optionalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/optionalParameters.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** optionalParameters.nice 16 Jul 2003 19:41:55 -0000 1.9 --- optionalParameters.nice 14 Oct 2004 20:50:09 -0000 1.10 *************** *** 25,29 **** line 148 as of CVS version 1.41. */ ! //<Any T> void printAny(T what = "Nothing"); //printAny(what) = println(what); --- 25,29 ---- line 148 as of CVS version 1.41. */ ! //<T> void printAny(T what = "Nothing"); //printAny(what) = println(what); Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/main.nice,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** main.nice 26 Feb 2003 16:07:58 -0000 1.31 --- main.nice 14 Oct 2004 20:50:09 -0000 1.32 *************** *** 6,10 **** } ! <Any I> I id(I); id(x) = x; --- 6,10 ---- } ! <I> I id(I); id(x) = x; Index: classes.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/classes.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** classes.nice 17 Jan 2004 16:38:42 -0000 1.14 --- classes.nice 14 Oct 2004 20:50:09 -0000 1.15 *************** *** 48,52 **** pToString(s@String) = "String"; ! <Any T> boolean isNull(T); isNull(x) = false; isNull(null) = true; --- 48,52 ---- pToString(s@String) = "String"; ! <T> boolean isNull(T); isNull(x) = false; isNull(null) = true; Index: exceptions.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/exceptions.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** exceptions.nice 9 Jun 2003 22:22:57 -0000 1.11 --- exceptions.nice 14 Oct 2004 20:50:09 -0000 1.12 *************** *** 64,68 **** } ! <Any T> T neverReturns() { throw new Error(); --- 64,68 ---- } ! <T> T neverReturns() { throw new Error(); Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/native.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** native.nice 15 Jun 2003 12:58:30 -0000 1.14 --- native.nice 14 Oct 2004 20:50:09 -0000 1.15 *************** *** 12,16 **** import java.io.*; ! //<Any T> T nop(T) = inline regtest.basic.Nop(); // rebind static and non-static fields --- 12,16 ---- import java.io.*; ! //<T> T nop(T) = inline regtest.basic.Nop(); // rebind static and non-static fields Index: null.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/null.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** null.nice 15 Jun 2003 12:58:30 -0000 1.12 --- null.nice 14 Oct 2004 20:50:09 -0000 1.13 *************** *** 21,25 **** // Testing the coverage test ! <Any T1, Any T2 | T1 <: ?String , T2 <: T1> void cov(T1 s1, T2 s2); // The domain of cov is exactly (?String, ?String) --- 21,25 ---- // Testing the coverage test ! <T1, T2 | T1 <: ?String , T2 <: T1> void cov(T1 s1, T2 s2); // The domain of cov is exactly (?String, ?String) *************** *** 32,36 **** // nullness marker with a parameterized type in constraint ! <Any T | T <: ?List<String>> void cov2(T x) {} // Test inference of non-nullness --- 32,36 ---- // nullness marker with a parameterized type in constraint ! <T | T <: ?List<String>> void cov2(T x) {} // Test inference of non-nullness |