Nice/testsuite/compiler/typing dti.testsuite,1.7,1.8

Arjan Boeijink <[email protected]>
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-serv21243/F:/nice/testsuite/compiler/typing

Modified Files:
	dti.testsuite 
Log Message:
Additional testcases for merging and instanceof type inference.

Index: dti.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/dti.testsuite,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** dti.testsuite	7 Mar 2005 23:02:44 -0000	1.7
--- dti.testsuite	8 Mar 2005 12:45:52 -0000	1.8
***************
*** 4,7 ****
--- 4,11 ----
  void maybeThrow() = throw new Exception();
  boolean maybeTrue() = true;
+ class A {}
+ class B extends A { int x = 0; }
+ class C extends A { int y = 1; }
+ class D extends C {}
  
  /// PASS
***************
*** 197,198 ****
--- 201,294 ----
      func();
    }
+ 
+ /// PASS bug
+   ?String s = maybeString();
+   try {
+     s = "abc";
+     maybeThrow();
+   } catch (Exception e) {
+     s = "abc";
+   }
+   s.substring(1);
+ 
+ /// PASS bug
+   ?String s = maybeString();
+   try {
+     s = null;
+     maybeThrow();
+   } catch (Exception e) {
+     s = null;
+   } finally  {
+     s = "abc";
+   }
+   s.substring(1);
+ 
+ /// PASS bug
+   A a = new A();
+   a = new B();
+   assert a.x == 0;
+ 
+ /// PASS bug
+   A a = new A();
+   a = new B();
+   a = new C();
+   assert a.y == 1;
+ 
+ /// PASS bug
+   A a = new A();
+   if (a instanceof B)
+     a = a;
+   else
+     a = new B();
+ 
+   assert a.x == 0;
+ 
+ /// FAIL
+   A a = new A();
+   if (! (a instanceof B))
+     a = new B();
+ 
+   a = new A();
+   assert a. /*/// FAIL HERE*/ x == 0;
+ 
+ /// PASS bug
+   A a = new A();
+   if (! (a instanceof B))
+     a = new B();
+   else
+     a = a;
+ 
+   assert a.x == 0;
+ 
+ /// FAIL
+   A a = new A();
+   if (maybeTrue())
+     a = new B();
+   else 
+     a = new C();
+ 
+   assert a. /*/// FAIL HERE*/ x == 0;
+ 
+ /// PASS bug
+   A a = new A();
+   if (maybeTrue())
+     a = new C();
+   else 
+     a = new D();
+ 
+   assert a.y == 1;
+ 
+ /// PASS bug
+  ?C a = new D();
+  if (maybeTrue())
+    {
+      if (a == null)
+        a = new C();
+    }
+  else
+    {
+      if (!(a instanceof D))
+        a = new D(); 
+    }
+ 
+  assert a.y == 1;



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.