[Nice-commit] Nice/testsuite/compiler/methods super.testsuite,1.4,1.5 nativeOverride.testsuite,1.2,1
Brought to you by:
bonniot
|
From: <bo...@us...> - 2003-04-18 14:50:54
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods
In directory sc8-pr-cvs1:/tmp/cvs-serv18316/testsuite/compiler/methods
Modified Files:
super.testsuite nativeOverride.testsuite
Log Message:
Allow implementations of native methods to dispatch on all their arguments.
Index: super.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/super.testsuite,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** super.testsuite 4 Mar 2003 16:50:11 -0000 1.4
--- super.testsuite 18 Apr 2003 14:50:17 -0000 1.5
***************
*** 151,154 ****
--- 151,189 ----
/// PASS
+ /// COMMENT super defined in an imported package for a java method.
+ /// package a
+ /// Toplevel
+ class C
+ {
+ toString() = "C";
+ }
+
+ /// package b import a
+ assert new D().toString().equals("CD");
+ /// Toplevel
+ class D extends C
+ {
+ toString() = super + "D";
+ }
+
+ /// FAIL
+ /// COMMENT super defined in an imported package for a java method.
+ /// package a
+ /// Toplevel
+ abstract class C {}
+ abstract class D extends C {}
+
+ equals(x@C, y@D) = true;
+ equals(x@D, y@C) = true;
+
+
+ /// package b import a
+ /// Toplevel
+ abstract class E extends D
+ {
+ equals(x@D) = /*/// FAIL HERE */ super; // This is ambiguous.
+ }
+
+ /// PASS
assert (new C().foo() == 1);
/// Toplevel
Index: nativeOverride.testsuite
===================================================================
RCS file: /cvsroot/nice/Nice/testsuite/compiler/methods/nativeOverride.testsuite,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** nativeOverride.testsuite 16 Apr 2003 16:54:28 -0000 1.2
--- nativeOverride.testsuite 18 Apr 2003 14:50:18 -0000 1.3
***************
*** 21,22 ****
--- 21,187 ----
toString() = (["A"].map(String s => s + "."))[0].toString();
}
+
+ /// PASS
+ assert new A(x: 1).equals(new A(x: 1));
+
+ /// Toplevel
+ class A
+ {
+ int x;
+
+ equals(that@A) = this.x == that.x;
+ }
+
+ /// PASS
+ assert ! new B(x: 1).equals(new A());
+ assert new B(x: 1).equals(new B(x: 1));
+
+ /// Toplevel
+ class A {}
+
+ class B extends A
+ {
+ int x;
+
+ equals(that@B) = this.x == that.x;
+ }
+
+ /// PASS
+ assert new B(x: 1).equals(new A());
+
+ /// Toplevel
+ class A {
+ equals(that@A) = true;
+ }
+
+ class B extends A
+ {
+ int x;
+
+ equals(that@B) = this.x == that.x;
+ }
+
+ /// PASS
+ assert new A(x: 1).equals(new A(x: 1));
+ assert new A(x: 1).equals(new B(x: 1, y: 0));
+ assert ! new A(x: 1).equals(new B(x: 1, y: 2));
+
+ /// Toplevel
+ class A
+ {
+ int x;
+
+ equals(that@A) = this.x == that.x;
+ equals(that@B) = this.x == that.x && that.y == 0;
+ }
+
+ class B extends A
+ {
+ int y;
+
+ equals(that@B) = this.x == that.x && this.y == that.y;
+ }
+
+ /// PASS
+ /// package a
+ /// Toplevel
+ class A
+ {
+ int x;
+
+ equals(that@A) = this.x == that.x;
+ }
+
+ /// package b import a
+ assert new A(x: 1).equals(new A(x: 1));
+
+ /// PASS
+ /// package a
+ /// Toplevel
+ class A
+ {
+ int x;
+
+ equals(that) = false;
+ equals(that@A) = this.x == that.x;
+ }
+
+ /// package b import a
+ assert new A(x: 1).equals(new A(x: 1));
+
+ /// PASS
+ /// package a
+ /// Toplevel
+ class A
+ {
+ int x;
+
+ equals(that@A) = this.x == that.x;
+ }
+
+ /// package b import a
+ assert ! new A(x: 1).equals(new B(x: 1));
+ /// Toplevel
+ class B extends A
+ {
+ equals(that@A) = super;
+ }
+ equals(this@A, that@B) = false;
+ equals(this@B, that@B) = true;
+
+ /// PASS
+ /// package a
+ /// Toplevel
+ class A
+ {
+ int x;
+
+ equals(that@A) = this.x == that.x;
+ }
+
+ boolean equals(String dummy1, boolean dummy2) = false;
+
+ /// package b import a
+ assert new A(x: 1).equals(new A(x: 1));
+
+ /// FAIL
+ ///Toplevel
+ /*/// FAIL HERE */ toString(s@String) = "";
+
+ /// FAIL
+ /// COMMENT Ambiguity for equals(B,B)
+ /// Toplevel
+ class A
+ {
+ equals(that@B) = false;
+ }
+
+ class B extends A
+ {
+ equals(that@A) = true;
+ }
+
+ /// FAIL
+ /// Toplevel
+ class A implements Runnable
+ {
+ }
+
+ class B extends A
+ {
+ run() {}
+ }
+
+ /// FAIL
+ /// Toplevel
+ class A extends java.lang.Number
+ {
+ }
+
+ class B extends A
+ {
+ doubleValue() = 0;
+ floatValue() = 0;
+ longValue() = 0;
+ intValue() = 0;
+ }
|