File: BadTest4.java

package info (click to toggle)
libnb-javaparser-java 9%2B2018-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 65,320 kB
  • sloc: java: 440,096; xml: 6,359; sh: 865; makefile: 314
file content (43 lines) | stat: -rw-r--r-- 1,138 bytes parent folder | download | duplicates (9)
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
37
38
39
40
41
42
43
/*
 * @test /nodynamiccopyright/
 * @bug 4736963
 * @summary Negative regression test from odersky
 * @author odersky
 *
 * @compile/fail/ref=BadTest4.out -XDrawDiagnostics -source 7 BadTest4.java
 * @compile BadTest4.java
 */

class BadTest4 {

    interface I {}
    interface J {}
    static class C implements I, J {}
    static class D implements I, J {}

    interface Ord {}

    static class Main {

        static C c = new C();
        static D d = new D();

        static <B> List<B> nil() { return new List<B>(); }
        static <A, B extends A> A f(A x, B y) { return x; }
        static <A, B extends A> B g(List<A> x, List<B> y) { return y.head; }

        static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
        static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
        static <A> A id(A x) { return x; }

        static Integer i = Integer.valueOf(1);
        static Number n = i;

        public static void main(String[] args) {
            Number x = f(n, i);
            x = f(i, n);
            f(cons("abc", nil()), nil());
            f(nil(), cons("abc", nil()));
        }
    }
}