File: compilation.testsuite

package info (click to toggle)
nice 0.9.12-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,220 kB
  • ctags: 6,894
  • sloc: java: 42,767; xml: 3,508; lisp: 1,079; sh: 736; makefile: 673; cpp: 21; awk: 3
file content (36 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/// PASS
  // Test that the method is compiled inside the class
  let m = A.class.getDeclaredMethod("foo", []);
  assert m.invoke(new A(), null).equals("ABC");

  /// Toplevel
class A
{
  String foo() = "ABC";
}

/// PASS
  // Check that polymorphic methods compiled inside classes get the right
  // bytecode type.
  /// package a
  /// Toplevel
class A {
  <A T> T foo(T x) = x;
}
  /// package b import a
  let B b = new B();
  let A a = new A();

  // invoke foo reflexively.
  // the method should be A.foo(A);
  let methodFoo = A.class.getMethod("foo", [A.class]);
  methodFoo.invoke(a, [b]);

  assert b.ran;

  /// Toplevel
final class B extends A {
  boolean ran = false;
}

foo(A a, B b) { b.ran = true; return b; }