Maurizio Cimadamore ed9c1bb743 8064464: regression with type inference of conditional expression
Bad classification of conditional leads to spurious error

Reviewed-by: jlahoda
2014-11-12 12:41:32 +00:00

24 lines
614 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8064464
* @summary regression with type inference of conditional expression
* @compile/fail/ref=T8064464.out -XDrawDiagnostics T8064464.java
*/
import java.util.List;
class T8064464 {
String f(Object o) { return null; }
Integer f(int i) { return null; }
<X extends Integer> X id() { return null; }
void m(List<Integer> lx) {
Integer i1 = f(!lx.isEmpty() ? 0 : lx.get(0)); //ok --> f(int)
Integer i2 = f(!lx.isEmpty() ? lx.get(0) : 0); //ok --> f(int)
f(!lx.isEmpty() ? id() : 0); // ambiguous
f(!lx.isEmpty() ? 0 : id()); // ambiguous
}
}