From: <yz...@us...> - 2011-01-27 23:41:13
|
Revision: 19779 http://x10.svn.sourceforge.net/x10/?rev=19779&view=rev Author: yzibin Date: 2011-01-27 23:41:05 +0000 (Thu, 27 Jan 2011) Log Message: ----------- * added the container to the name of methods that return the outer this. * an assertion failed (moved it into the if) * excluded FrontEndTests_MustFailCompile and some other tests from the suite * changed the error markers of some tests Modified Paths: -------------- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java trunk/x10.compiler/src/x10/ast/X10Special_c.java trunk/x10.compiler/src/x10/util/RunTestSuite.java trunk/x10.compiler/src/x10/visit/Desugarer.java trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Class/InconsistentInvariant_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/ClassDepClause_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency1_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency2_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/DepType/InconsistentInterfaceInvariants_MustFailCompile.x10 trunk/x10.tests/examples/Constructs/Structs/StructObscuringExample.x10 trunk/x10.tests/examples/Issues/XTENLANG_2330.x10 trunk/x10.tests/examples/Misc/x10/frontend/tests/FrontEndTests_MustFailCompile.x10 Modified: trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.compiler/src/x10/ast/X10ClassDecl_c.java 2011-01-27 23:41:05 UTC (rev 19779) @@ -501,33 +501,42 @@ // adding methods to access the outer instances (used in Desugarer.desugarCall) - // e.g., + // The method name includes both the container name and the qualifier name to handle this nasty case: + //class A[T] { + // public final def A$$A$this() = A.this; + // class Inner extends A[Int] { + // public final def Inner$$A$this() = A.this; // the return type is different! + // public final def Inner$$Inner$this() = Inner.this; + // } + //} + // Another simpler example: // class A { - // public def A$this() = A.this; + // public final def A$$A$this() = A.this; // class B { - // public def B$this() = B.this; - // public def A$this() = A.this; + // public final def B$$B$this() = B.this; + // public final def B$$A$this() = A.this; // } // class D extends B { - // public def D$this() = D.this; - // public def A$this() = A.this; // this is why the methods cannot be FINAL + // public final def D$$D$this() = D.this; + // public final def D$$A$this() = A.this; // } // static class C { - // public def C$this() = C.this; + // public final def C$$C$this() = C.this; // } // } { final Position pos = n.position().markCompilerGenerated(); - final Flags flags = Flags.PUBLIC; + final Flags flags = Flags.PUBLIC.Final(); final NodeFactory nf = tb.nodeFactory(); + final QName containerName = def.fullName(); ClassType curr = def.asType(); while (curr!=null) { if (curr.flags().isInterface()) break; final UnknownTypeNode returnType = nf.UnknownTypeNode(pos); final QName fullName = curr.fullName(); - MethodDecl md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),returnType,nf.Id(pos,getThisMethod(fullName)),Collections.<Formal>emptyList(), + MethodDecl md = nf.MethodDecl(pos,nf.FlagsNode(pos,flags),returnType,nf.Id(pos,getThisMethod(containerName,fullName)),Collections.<Formal>emptyList(), nf.Block(pos,nf.Return(pos,nf.Special(pos, Special.Kind.THIS, nf.TypeNodeFromQualifiedName(pos,fullName))))); n = (X10ClassDecl_c) n.body(n.body().addMember(md)); @@ -539,8 +548,12 @@ return n; } - public static Name getThisMethod(QName n) { - return Name.make(n.toString().replace('.','$')+"$this"); + public static Name getThisMethod(QName containerName, QName n) { + return Name.make( + containerName.toString().replace('.','$')+ + "$$"+ + n.toString().replace('.','$')+ + "$this"); } private X10ClassDecl_c superPreBuildTypes(TypeBuilder tb) throws SemanticException { Modified: trunk/x10.compiler/src/x10/ast/X10Special_c.java =================================================================== --- trunk/x10.compiler/src/x10/ast/X10Special_c.java 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.compiler/src/x10/ast/X10Special_c.java 2011-01-27 23:41:05 UTC (rev 19779) @@ -156,8 +156,8 @@ cc = cc == null ? new CConstraint() : cc.copy(); try { XVar var = (XVar) xts.xtypeTranslator().translate(cc, this, c); - assert var instanceof CThis; if (var != null) { + assert var instanceof CThis; cc.addSelfBinding(var); cc.setThisVar(var); //PlaceChecker.AddThisHomeEqualsPlaceTerm(cc, var, c); Modified: trunk/x10.compiler/src/x10/util/RunTestSuite.java =================================================================== --- trunk/x10.compiler/src/x10/util/RunTestSuite.java 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.compiler/src/x10/util/RunTestSuite.java 2011-01-27 23:41:05 UTC (rev 19779) @@ -151,13 +151,17 @@ public static String SOURCE_PATH_SEP = File.pathSeparator; // on MAC the separator is ":" and on windows it is ";" private static void println(String s) { - if (!QUIET) System.out.println(s); + if (!QUIET) { + System.out.println(s); + System.out.flush(); + } } private static int EXIT_CODE = 0; private static java.lang.StringBuilder ALL_ERRORS = new StringBuilder(); private static void err(String s) { EXIT_CODE = 1; System.err.println(s); + System.err.flush(); ALL_ERRORS.append(s).append("\n"); } @@ -171,6 +175,8 @@ "NOT_WORKING", // to exclude some benchmarks: https://x10.svn.sourceforge.net/svnroot/x10/benchmarks/trunk }; private static final String[] EXCLUDE_FILES = { + "FrontEndTests_MustFailCompile.x10", + // difference on MAC and PC (on PC the compiler crashes, on MAC it outputs this error: Semantic Error: Type definition type static TypedefOverloading06_MustFailCompile.A = x10.lang.String has the same name as member class TypedefOverloading06_MustFailCompile.A. "TypedefOverloading04_MustFailCompile.x10", "TypedefOverloading06_MustFailCompile.x10", @@ -181,6 +187,7 @@ // LangSpec is auto-generated, so I can't fix those files to make a clean test suite "Classes250.x10","Classes160.x10","Classes170.x10", + "Interfaces3l4a.x10", "Interfaces_static_val.x10", "Types2y3i.x10", "Types6a9m.x10", "InnerClasses5p9v.x10","Packages5t5g.x10","Stimulus.x10","Statements51.x10", "ClassCtor30_MustFailCompile.x10", "ThisEscapingViaAt_MustFailCompile.x10", }; private static final String[] EXCLUDE_FILES_WITH = { Modified: trunk/x10.compiler/src/x10/visit/Desugarer.java =================================================================== --- trunk/x10.compiler/src/x10/visit/Desugarer.java 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.compiler/src/x10/visit/Desugarer.java 2011-01-27 23:41:05 UTC (rev 19779) @@ -484,7 +484,7 @@ // qualifer doesn't have type info because it was created in Synthesizer.makeExpr qualifer = (TypeNode) qualifer.visit(new X10TypeBuilder(job, ts, nf)).visit(new X10TypeChecker(job, ts, nf, job.nodeMemo()).context(closureContext)); ClassType ct = qualifer.type().toClass(); - return nf.Call(pos,newReceiver, nf.Id(pos,X10ClassDecl_c.getThisMethod(ct.fullName()))); + return nf.Call(pos,newReceiver, nf.Id(pos,X10ClassDecl_c.getThisMethod(newReceiver.type().toClass().def().fullName(),ct.fullName()))); } if (n instanceof AmbExpr) { AmbExpr amb = (AmbExpr) n; Modified: trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 =================================================================== --- trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.dist/samples/CUDA/CUDABlackScholes.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -150,11 +150,11 @@ Console.OUT.println("Generating a second set of results at place " + cpu); doBlackScholes(cpu, - new RemoteArray[Float](h_OptionYears), - new RemoteArray[Float](h_StockPrice), - new RemoteArray[Float](h_OptionStrike), - new RemoteArray[Float](h_CallResultCPU), - new RemoteArray[Float](h_PutResultCPU), + new RemoteArray[Float](h_OptionYears) as RemoteArray[Float]{home==cpu && rank==1}, + new RemoteArray[Float](h_StockPrice) as RemoteArray[Float]{home==cpu && rank==1}, + new RemoteArray[Float](h_OptionStrike) as RemoteArray[Float]{home==cpu && rank==1}, + new RemoteArray[Float](h_CallResultCPU) as RemoteArray[Float]{home==cpu && rank==1}, + new RemoteArray[Float](h_PutResultCPU) as RemoteArray[Float]{home==cpu && rank==1}, OPT_N, RISKFREE, VOLATILITY); Modified: trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/Array/ArrayAccessWithMismatchingPointRank_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -11,6 +11,8 @@ import harness.x10Test; +// OPTIONS: -STATIC_CALLS because without will just insert a cast: Warning: Expression 'p' was cast to type ... + /** * Simple array test. * Testing that ia(p) gives an error, where ia:Array[int](1) and p:Point(2). @@ -28,7 +30,7 @@ val p1 = [1] as Point; a(ia(p1)); // ok - a(ia(p)); // ERR ShouldNotBeERR should fail at compile time because of mismatching rank. + a(ia(p)); // ERR should fail at compile time because of mismatching rank. return true; } Modified: trunk/x10.tests/examples/Constructs/Class/InconsistentInvariant_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Class/InconsistentInvariant_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/Class/InconsistentInvariant_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -21,7 +21,7 @@ public class InconsistentInvariant_MustFailCompile extends x10Test { - interface Inv(i:Int){i==0, i==1}{} // ERR: Class invariant is inconsistent. + interface Inv(i:Int){i==0, i==1}{} // ShouldBeErr: Class invariant is inconsistent. public def run()=false; public static def main(Array[String](1)) { new InconsistentInvariant_MustFailCompile().execute(); Modified: trunk/x10.tests/examples/Constructs/DepType/ClassDepClause_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/ClassDepClause_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/DepType/ClassDepClause_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -21,7 +21,8 @@ public static type ClassDepClause_MustFailCompile(i:int, j:int)=ClassDepClause_MustFailCompile{self.i==i,self.j==j}; public def this(i: int, j: int): ClassDepClause_MustFailCompile(i,j) = { property(i,j);} // ShouldBeErr public def run(): boolean = { - var x: ClassDepClause_MustFailCompile(2,3) = new ClassDepClause_MustFailCompile(2,3); // ShouldBeErr + var x: ClassDepClause_MustFailCompile(2,3) = // ERR: Semantic Error: Invalid type; the real clause of ClassDepClause_MustFailCompile{self.i==2, self.j==3} is inconsistent. + new ClassDepClause_MustFailCompile(2,3); // ERR: Semantic Error: Cannot assign expression to target. return true; } Modified: trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency1_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency1_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency1_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -20,8 +20,8 @@ public class DepTypeConsistency1_MustFailCompile extends x10Test { /* free variable i is not parametrically consistent */ - class Tester(i:int{self == 2}){i == 3} { // ShouldBeErr - public def this(arg:int):Tester = { property(arg);} // ShouldNotBeERR ShouldNotBeERR (The return type of the constructor (DepTypeConsistency1_MustFailCompile.Tester) must be derived from the type of the class (DepTypeConsistency1_MustFailCompile.Tester) on which the constructor is defined.) + class Tester(i:int{self == 2}){i == 3} { // ERR ERR ERR ERR: [Semantic Error: Invalid type; the real clause of DepTypeConsistency1_MustFailCompile.Tester{self==DepTypeConsistency1_MustFailCompile.Tester#this} is inconsistent. , Semantic Error: Invalid type; the real clause of DepTypeConsistency1_MustFailCompile.Tester is inconsistent.] + public def this(arg:int):Tester = { property(arg);} // ShouldNotBeERR: [Semantic Error: Invalid type; the real clause of DepTypeConsistency1_MustFailCompile.Tester{self.i==arg} is inconsistent.] } public def run()=true; Modified: trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency2_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency2_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency2_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -20,8 +20,8 @@ public class DepTypeConsistency2_MustFailCompile extends x10Test { /* free variable i is not parametrically consistent */ - class Tester(i:int{self == 2,self==3}) { // ERR ERR: Type x10.lang.Int{inconsistent} is inconsistent. Invalid type; the real clause of x10.lang.Int{inconsistent} is inconsistent. - public def this(arg:int):Tester = { property(arg);} + class Tester(i:int{self == 2,self==3}) { // ERR ERR ERR: Type x10.lang.Int{inconsistent} is inconsistent. Invalid type; the real clause of x10.lang.Int{inconsistent} is inconsistent. + public def this(arg:int):Tester = { property(arg);} // ShouldNotBeERR: Semantic Error: Invalid type; the real clause of DepTypeConsistency2_MustFailCompile.Tester{self.i==arg} is inconsistent. } public def run()=true; Modified: trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/DepType/DepTypeConsistency_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -20,7 +20,7 @@ public class DepTypeConsistency_MustFailCompile extends x10Test { static val j:int = 3; /* free variable j is not parametrically consistent */ - class Tester(i:int){j == 2} { // ERR + class Tester(i:int){j == 2} { // ShouldBeErr public def this(arg:int):Tester { property(arg); } } Modified: trunk/x10.tests/examples/Constructs/DepType/InconsistentInterfaceInvariants_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/DepType/InconsistentInterfaceInvariants_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/DepType/InconsistentInterfaceInvariants_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -17,6 +17,7 @@ * */ import harness.x10Test; +import x10.compiler.tests.*; // err markers /** Tests that invariants due to a super constraint and a sub constraint are * consistent with each other. @@ -29,7 +30,7 @@ public def put():int; } - public static interface Test1{this.l == 0, this.m == 1} extends Test { + @ERR public static interface Test1{this.l == 0, this.m == 1} extends Test { // Semantic Error: Class invariant is inconsistent. public def foo(): int; } Modified: trunk/x10.tests/examples/Constructs/Structs/StructObscuringExample.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/Structs/StructObscuringExample.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Constructs/Structs/StructObscuringExample.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -21,7 +21,7 @@ import x10.compiler.*; // @Uncounted @NonEscaping @NoThisAccess import x10.compiler.tests.*; // err markers -public class StructObscuringExample extends x10Test { +public class StructObscuringExample extends x10Test { // ShouldNotBeERR ShouldNotBeERR: Could not find type "eg.eg.StructObscuringExample". public static def main(Array[String](1)){ val p = new StructObscuringExample(); p.execute(); @@ -34,9 +34,9 @@ } -struct eg { // ShouldNotBeERR +struct eg { // ShouldNotBeERR ShouldNotBeERR static def ow()= 1; - static struct Bite { // ShouldNotBeERR ShouldNotBeERR + static struct Bite { // ShouldNotBeERR ShouldNotBeERR ShouldNotBeERR def ow() = 2; } def example() { Modified: trunk/x10.tests/examples/Issues/XTENLANG_2330.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_2330.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Issues/XTENLANG_2330.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -181,7 +181,7 @@ try { this(z+51) += z+0; fail(); } catch (e:UnsatisfiedGuardException) {} // ERR // We already handle: Call, New, Binary, Unary, SettableAssign, Cast - // We still need to handle in the desugarer: ConstructorCall (XTENLANG_2376) , ClosureCall & Unary (XTENLANG_2329) + // We still need to handle in the desugarer: ConstructorCall (XTENLANG_2376) , ClosureCall (XTENLANG_2329) // far to do: after XTENLANG_2376 is resolved, we should check runtime checks for guards for ctor calls (super&this) // todo: After XTENLANG_2329 is resolved, we could check guards for closure calls @@ -248,13 +248,13 @@ super(i); property(i); } - def this(i1:Int, i2:Int) {i1!=i2, i1==p} : C { // testing 2 binary expressions + def this(i1:Int, i2:Int) {i1!=i2, i1==p} { // testing 2 binary expressions super(i1); property(i2); } class D(d:Int) extends A { - def this(i1:Int, i2:Int) {i1!=i2, i1==p, i2==c} : D { // testing 3 binary expressions + def this(i1:Int, i2:Int) {i1!=i2, i1==p, i2==c} { // testing 3 binary expressions super(i1); property(i2); } @@ -272,7 +272,6 @@ // Here I just test that post-compilation works on more complicated examples (but I don't check runtime behaviour) class TestWithoutGenerics { - public static def main(argv:Array[String](1)) {} static def m2(a:Int, b:Outer.A) {a==44, b.x.x.y==35} = 1; class Outer(zz:Int) { Modified: trunk/x10.tests/examples/Misc/x10/frontend/tests/FrontEndTests_MustFailCompile.x10 =================================================================== --- trunk/x10.tests/examples/Misc/x10/frontend/tests/FrontEndTests_MustFailCompile.x10 2011-01-27 22:49:58 UTC (rev 19778) +++ trunk/x10.tests/examples/Misc/x10/frontend/tests/FrontEndTests_MustFailCompile.x10 2011-01-27 23:41:05 UTC (rev 19779) @@ -12,6 +12,9 @@ package x10.frontend.tests; // TODO: We should put ALL our tests in different packages according to the directory structure +// OPTIONS: -STATIC_CALLS + + import harness.x10Test; import x10.compiler.*; // @Uncounted @NonEscaping @NoThisAccess @@ -2233,10 +2236,10 @@ } } interface I2 extends I{p==2} {} // ShouldBeErr - interface I3 {p==3} extends I2 {} // ShouldBeErr + @ERR interface I3 {p==3} extends I2 {} // Class invariant is inconsistent. static def test(i:I) { - @ShouldBeErr var i1:I{p==5} = i; - var i2:I{p==1} = i; + @ERR var i1:I{p==5} = i; + @ShouldNotBeERR var i2:I{p==1} = i; } } @@ -2248,8 +2251,8 @@ static def test(a:OuterThisConstraint{i==3}) { val inner:OuterThisConstraint{self.i==3}.Inner = a.new Inner(); val x1:OuterThisConstraint{i==3} = a.m1(); - val x2:OuterThisConstraint{i==3} = inner.m2(); - @ShouldBeErr val x3:OuterThisConstraint{i==4} = inner.m2(); + @ShouldNotBeERR val x2:OuterThisConstraint{i==3} = inner.m2(); + @ERR val x3:OuterThisConstraint{i==4} = inner.m2(); } } @@ -3254,7 +3257,7 @@ class XTENLANG_1574(v:Int) {v==1} { static def m(a:XTENLANG_1574) { val b:XTENLANG_1574{self.v==1} = a; - @ERR val b2:XTENLANG_1574{self.v==2} = a; + @ERR @ERR val b2:XTENLANG_1574{self.v==2} = a; // [Semantic Error: Cannot assign expression to target. Expression: a Expected type: x10.frontend.tests.XTENLANG_1574{self.v==2} Found type: x10.frontend.tests.XTENLANG_1574{self==a}, Semantic Error: Invalid type; the real clause of x10.frontend.tests.XTENLANG_1574{self.v==2} is inconsistent.] } } class TestMethodGuards[T](a:Int, p:Place) { @@ -3585,13 +3588,13 @@ static class A(v:Int) {v==1} { static def m(a:A) { val b:A{self.v==1} = a; - @ERR val b2:A{self.v==2} = a; + @ERR @ERR val b2:A{self.v==2} = a; } def m2(a:A) { val b1:A{self.v==1} = this; val b2:A{this.v==1} = this; val b3:A{self.v==1} = a; - @ERR val b33:A{self.v==2} = a; + @ERR @ERR val b33:A{self.v==2} = a; val b4:A{this.v==1} = a; } } @@ -4068,9 +4071,9 @@ property i() = 5; @ERR class R extends R {i()==5} {} @ERR class R1 {i()==3} {} - @ERR class R2 {@ERR i()==3} extends R2 {} + @ERR class R2 {i()==3} extends R2 {} // [Semantic Error: Circular inheritance involving x10.frontend.tests.CircularityTestsWithInheritanceInterfacesAndStructs.R2] class R3 {} - @ERR @ERR @ERR class R4 extends R3 {@ERR i()==3} {} + @ERR @ERR class R4 extends R3 {i()==3} {} // [Semantic Error: Invalid type; the real clause of x10.frontend.tests.CircularityTestsWithInheritanceInterfacesAndStructs.R3{inconsistent} is inconsistent., Semantic Error: Type x10.frontend.tests.CircularityTestsWithInheritanceInterfacesAndStructs.R3{inconsistent} is inconsistent.] @ERR static class W extends W {} static val i=3; @@ -4496,4 +4499,38 @@ property(6); // ShouldNotBeERR: Semantic Error: Instances created by this constructor do not satisfy return type Constraint satisfied: {X.C#this.b==5, X.C#this.c==6, i1!=i2} Constraint required: {X.C#this.b==5, X.C#this.c==6, i1!=i2} } } +} +class CodegenForHasZeroTest[T] { // see XTENLANG-2388 + def m() { + @ShouldNotBeERR val b = T haszero; // Unhandled node type: class x10.ast.HasZeroTest_c + } +} +class XTENLANG_2389 { + property foo()=A.this; + class B { + property bar()=A.this; + property foo2()=B.this; + } + def bla(a1:A, a2:A{this==a1}) { + @ShouldBeErr val a3:A{self==a1} = a2; + @ShouldBeErr val a4:A{self!=a1} = a2; + } + + def test1(a1:A, a2:A{self.foo()==a1}) {} + def test2(a1:A, a2:A{A.this==a1}) { + @ERR { test1(a1,a2); } + } + def test3(a1:A, b2:B{self.bar()==a1}) {} + def test4(a:A, b:B{A.this==a}) { + @ShouldBeErr { test3(a,b); } + } +} + +class XTENLANG_2390 { + protected val a:Int; + def this(x:Int) { + a = x; + } + def m1(i:Int{self==a}) {} // ShouldBeErr + def m2() {2==a} {} // ShouldBeErr } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |