overload resolution: prefer candidates with functional formal type if lambda is passed; this way conflict would be resolved and nested error would be shown instead

This commit is contained in:
Anna Kozlova
2016-09-16 08:32:43 +03:00
parent a493ff0f1d
commit f4dae32d7f
5 changed files with 82 additions and 23 deletions

View File

@@ -0,0 +1,25 @@
import java.util.function.*;
class Test {
void foo(Function<String, String> f) {}
void foo(String f) {}
{
foo(a -> {
String s = a.substring(0);
<error descr="Missing return statement">}</error>);
}
interface A {
void m(String s);
}
void bar(Function<String, String> f) {}
void bar(A f) {}
{
bar(a -> {
String s = a.substring(0);
});
}
}