mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
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:
+1
-1
@@ -52,7 +52,7 @@ class Test {
|
||||
static {
|
||||
Test s1 = staticCall(Test::n0);
|
||||
Test s2 = staticCall(Test::n1);
|
||||
Test s3 = <error descr="Cannot resolve method 'staticCall(<method reference>)'">staticCall</error>(Test::n2);
|
||||
Test s3 = staticCall<error descr="Cannot resolve method 'staticCall(<method reference>)'">(Test::n2)</error>;
|
||||
Test s4 = staticCall<error descr="Ambiguous method call: both 'Test.staticCall(I1<Test>)' and 'Test.staticCall(I2<Test, String>)' match">(Test::n01)</error>;
|
||||
Test s5 = staticCall<error descr="Ambiguous method call: both 'Test.staticCall(I1<Test>)' and 'Test.staticCall(I2<Test, String>)' match">(Test::n012)</error>;
|
||||
}
|
||||
|
||||
+25
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user