Update of /cvsroot/nice/Nice/testsuite/compiler/typing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20429/testsuite/compiler/typing
Modified Files:
wildcards.testsuite
Log Message:
Better implementation of wildcards (fixes #1216727).
Index: wildcards.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/wildcards.testsuite,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** wildcards.testsuite 31 May 2005 07:32:49 -0000 1.3
--- wildcards.testsuite 9 Jun 2005 11:56:59 -0000 1.4
***************
*** 37,40 ****
--- 37,45 ----
+ /// PASS
+ /// Toplevel
+ class A<T0> { T0 x; }
+ Object foo(A<?> a) = a.x;
+
/// FAIL
A<int,String> a = new A(x1: 0, x2: "");
***************
*** 74,75 ****
--- 79,140 ----
void foo(A<?> a) = bar(a.x);
<T> void bar(T x) {}
+
+ /// FAIL
+ A<int> a1 = new A(x: 0);
+ A<String> a2 = new A(x: "");
+ foo(a1, a2);
+ int x = a1.x;
+ /// Toplevel
+ class A<T> { T x; }
+
+ void foo(A<int> a1, A<?> a2) = /*/// FAIL HERE */ splash(a1, a2);
+
+ <T> void splash(A<T> a1, A<T> a2)
+ {
+ a1.x = a2.x;
+ }
+
+
+ /// FAIL
+ A<B<String>> a = new A(x: new B(y: ""));
+ /*/// FAIL HERE */ foo(a);
+ String s = a.x.y;
+
+ /// Toplevel
+ class A<T> { T x; }
+ class B<T> { T y; }
+
+ void foo(A<B<?>> a) { a.x = new B(y: 0); }
+
+ /// PASS
+ foo(new A(x: new B(y: "")));
+
+ /// Toplevel
+ class A<TA> { TA x; }
+ class B<TB> { TB y; }
+
+ void foo(A<B<?>> a) {}
+
+ /// FAIL
+ A<String>[] as = [new A(x: "")];
+ /*/// FAIL HERE */ getM(as);
+ String s = as[0].x;
+ /// Toplevel
+ class A<T> { T x; }
+
+ void getM(A<?>[] a) { a[0] = new A(x: 0); }
+
+
+ /// FAIL
+ // bug #1216727
+ /// Toplevel
+ class Cons<TT> {
+ TT head;
+ Cons<TT> tail;
+ boolean isEmpty() = false;
+ }
+
+ void _testEmpty(Cons<?> c)
+ {
+ let cc = /*/// FAIL HERE */ new Cons(head: 1, tail: c);
+ }
|