Nice/testsuite/compiler/typing wildcards.testsuite,1.1,1.2

Daniel Bonniot <[email protected]> Wed, 25 May 2005 23:22:59 +0000
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/testsuite/compiler/typing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2569/testsuite/compiler/typing

Modified Files:
	wildcards.testsuite 
Log Message:
Fix subtyping of wildcards. Should be safe, but overrestrictive, since
a wildcard is now not a subtype of itself.


Index: wildcards.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/wildcards.testsuite,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** wildcards.testsuite	25 May 2005 15:26:17 -0000	1.1
--- wildcards.testsuite	25 May 2005 23:22:56 -0000	1.2
***************
*** 16,17 ****
--- 16,69 ----
    (a.x1, a.x2) = (a.x2, a.x1);
  }
+ 
+ /// PASS
+   /// Toplevel
+ class A<T> { T x1; T x2; }
+ void swap(A<?> a)
+ {
+   let tmp = a.x1;
+   a.x1 = a.x2;
+   a.x2 = tmp;
+ }
+ 
+ /// FAIL
+   A<int> a = new A(x: 0);
+   A<?> aa = a;
+   /*/// FAIL HERE */ aa.x = "";
+   int i = a.x;
+ 
+   /// Toplevel
+ class A<T> { T x; }
+ 
+ 
+ /// FAIL
+   A<int,String> a = new A(x1: 0, x2: "");
+   splash(a);
+   int i = a.x1;
+ 
+   /// Toplevel
+ class A<T1,T2> { T1 x1; T2 x2; }
+ void splash(A<?,?> a) {
+   /*/// FAIL HERE */ a.x1 = a.x2;
+ }
+ 
+ /// FAIL
+   A<int,String> a = new A(x1: 0, x2: "");
+   splash(a);
+   String s = a.x2;
+ 
+   /// Toplevel
+ class A<T1,T2> { T1 x1; T2 x2; }
+ void splash(A<?,?> a) {
+   /*/// FAIL HERE */ a.x2 = a.x1;
+ }
+ 
+ /// FAIL
+   A<int,String> a = new A(x1: 0, x2: "");
+   splash(a);
+ 
+   /// Toplevel
+ class A<T1,T2> { T1 x1; T2 x2; }
+ void splash(A<?,?> a) {
+   int /*/// FAIL HERE */ x = a.x2;
+ }



-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click