2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2015-05-15 23:53:42 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2007-12-01 00:00:00 +00:00
|
|
|
* @summary Negative regression test from odersky
|
|
|
|
* @author odersky
|
|
|
|
*
|
2022-07-29 17:35:22 +00:00
|
|
|
* @compile/fail/ref=BadTest-old.out -XDrawDiagnostics --release 15 BadTest.java
|
2015-05-15 23:53:42 +00:00
|
|
|
* @compile/fail/ref=BadTest.out -XDrawDiagnostics BadTest.java
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class BadTest {
|
|
|
|
static class Main {
|
|
|
|
|
|
|
|
static <B> List<B> nil() { return new List<B>(); }
|
|
|
|
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; }
|
|
|
|
|
2023-01-17 04:43:40 +00:00
|
|
|
public static void meth() {
|
2007-12-01 00:00:00 +00:00
|
|
|
List<Cell<String>> as = nil().prepend(makeCell(null));
|
|
|
|
List<Cell<String>> bs = cons(makeCell(null), nil());
|
|
|
|
List<String> xs = id(nil());
|
|
|
|
List<String> ys = cons("abc", id(nil()));
|
|
|
|
List<String> zs = id(nil()).prepend("abc");
|
|
|
|
List<Cell<String>> us = id(nil()).prepend(makeCell(null));
|
|
|
|
List<Cell<String>> vs = cons(makeCell(null), id(nil()));
|
|
|
|
System.out.println(nil() instanceof List<String>);
|
|
|
|
nil();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|