From: Vijay S. <vj...@us...> - 2008-08-31 04:02:29
|
Update of /cvsroot/x10/x10.tests/examples/Constructs/DepType In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv15526/examples/Constructs/DepType Added Files: CastChecking_MustFailCompile.x10 Log Message: Succeeds. --- NEW FILE: CastChecking_MustFailCompile.x10 --- /* * * (C) Copyright IBM Corporation 2006 * * This file is part of X10 Test. * */ import harness.x10Test;; /** * Check that a cast involving types which are not related by supertype or subtype * relation fails * * @author pvarma */ public class CastChecking_MustFailCompile extends x10Test { class Test( i:int, j:int) { def this(val i: int, val j: int): Test{self.i==i && self.j==j} = { property(i,j); } } class Test2(k:int) extends Test{i==j} { def this(val k: int): Test2{self.i==k&&self.j==k&&self.k==k} = { super(k,k); property(k); } } class Test3 (l:int) { def this(var l: int): Test3 = { property(l);} } public def run(): boolean = { var a: Test2{k==1&&i==j} = new Test2(1); var b: Test{i==j} = a; var d: Test = new Test3(1) to Test; // must fail compile return true; } public static def main(var args: Rail[String]): void = { new CastChecking_MustFailCompile().execute(); } } |