author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 30721 | langtools/test/tools/javac/generics/odersky/BadTest.java@1024d425d97e |
permissions | -rw-r--r-- |
10 | 1 |
/* |
30721
1024d425d97e
8074425: Group 13b: golden files for tests in tools/javac/generics dir
sogoel
parents:
5520
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
10 | 3 |
* @summary Negative regression test from odersky |
4 |
* @author odersky |
|
5 |
* |
|
30721
1024d425d97e
8074425: Group 13b: golden files for tests in tools/javac/generics dir
sogoel
parents:
5520
diff
changeset
|
6 |
* @compile/fail/ref=BadTest.out -XDrawDiagnostics BadTest.java |
10 | 7 |
*/ |
8 |
||
9 |
class BadTest { |
|
10 |
static class Main { |
|
11 |
||
12 |
static <B> List<B> nil() { return new List<B>(); } |
|
13 |
static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); } |
|
14 |
static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); } |
|
15 |
static <A> A id(A x) { return x; } |
|
16 |
||
17 |
public static void main(String[] args) { |
|
18 |
List<Cell<String>> as = nil().prepend(makeCell(null)); |
|
19 |
List<Cell<String>> bs = cons(makeCell(null), nil()); |
|
20 |
List<String> xs = id(nil()); |
|
21 |
List<String> ys = cons("abc", id(nil())); |
|
22 |
List<String> zs = id(nil()).prepend("abc"); |
|
23 |
List<Cell<String>> us = id(nil()).prepend(makeCell(null)); |
|
24 |
List<Cell<String>> vs = cons(makeCell(null), id(nil())); |
|
25 |
System.out.println(nil() instanceof List<String>); |
|
26 |
nil(); |
|
27 |
} |
|
28 |
||
29 |
} |
|
30 |
} |