[Nice-commit] Nice/testsuite/compiler/typing instanceof.testsuite,1.4,1.5
Brought to you by:
bonniot
From: <ar...@us...> - 2003-10-06 18:22:26
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv22778/F:/nice/testsuite/compiler/typing Modified Files: instanceof.testsuite Log Message: Improved type inference for instanceof it can handle the same cases as nullness inference now. Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/instanceof.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** instanceof.testsuite 5 Oct 2003 23:23:13 -0000 1.4 --- instanceof.testsuite 6 Oct 2003 18:22:22 -0000 1.5 *************** *** 106,107 **** --- 106,182 ---- class C implements X {} class D implements X,Y {} + + /// PASS + A x = new B(); + if (!( x instanceof B)) + assert false; + else + assert x.life == 42; + + /// PASS + assert foo(new B()) == 42; + /// Toplevel + int foo(A x) { + if (!( x instanceof B)) + return 0; + + return x.life; + } + + /// FAIL + A x = new B(); + int i = 0; + if (x instanceof B) + i = x.life; + else + i = x./* /// FAIL HERE */life; + + /// FAIL + A x = new B(); + int i = 0; + if (x instanceof B) + i = x.life; + + i = x./* /// FAIL HERE */life; + + /// PASS + A x = new B(); + A y = new B(); + int i = 0; + if (x instanceof B && y instanceof B) + i = x.life + y.life; + else + assert false; + + /// PASS + A x = new B(); + A y = new B(); + int i = 0; + if (!(x instanceof B) || !(y instanceof B)) + assert false; + else + i = x.life + y.life; + + /// PASS + A x = new B(); + if (x instanceof B && x.life == 42) + assert true; + else + assert false; + + /// FAIL + A x = new B(); + if ((!(x instanceof B)) && x./* /// FAIL HERE */life == 42) + assert true; + + /// PASS + A x = new B(); + if ((!(x instanceof B)) || x.life == 42) + assert true; + else + assert false; + + /// FAIL + A x = new B(); + if (x instanceof B || x./* /// FAIL HERE */life == 42) + assert true; |