new inference: report inference errors of containing call for lambdas

This commit is contained in:
Anna Kozlova
2015-11-20 21:47:13 +01:00
parent 19a7ef3488
commit be2db1f940
9 changed files with 28 additions and 25 deletions
@@ -5,7 +5,7 @@ import java.util.function.Consumer;
class Test {
public static void main(String[] args) {
Iterable<Consumer<Reader>> i = Arrays.asList((r) -> <error descr="Unhandled exception: java.io.IOException">r.read()</error>);
Iterable<Consumer<Reader>> i = Arrays.asList(<error descr="Unhandled exception: IOException">(r) -> r.read()</error>);
Iterable<Consumer<Reader>> i1 = Arrays.<Consumer<Reader>>asList((r) -> <error descr="Unhandled exception: java.io.IOException">r.read()</error>);
}
}
@@ -9,7 +9,9 @@ class Test {
<R> SuperFoo<R> foo(I<R> ax) { return null; }
SuperFoo<String> ls = foo(() -> <error descr="Bad return type in lambda expression: Foo<X> cannot be converted to SuperFoo<R>">new Foo<>()</error>);
SuperFoo<String> ls = foo(<error descr="inference variable R has incompatible bounds:
equality constraints: String
upper bounds: Object, Number">() -> new Foo<>()</error>);
SuperFoo<Integer> li = foo(() -> new Foo<>());
SuperFoo<?> lw = foo(() -> new Foo<>());
}
@@ -7,7 +7,7 @@ class Test {
<T extends Runnable> void call1(T t) {}
{
call<error descr="'call(T)' in 'Test' cannot be applied to '(<lambda expression>)'">(() -> {})</error>;
call(<error descr="Object is not a functional interface">() -> {}</error>);
call1(() -> {});
}
}