mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
new overload resolution: check only functional arguments in isFunctionalTypeMoreSpecific (IDEA-134328)
This commit is contained in:
@@ -1201,7 +1201,7 @@ public class InferenceSession {
|
||||
continue;
|
||||
}
|
||||
if (LambdaUtil.isFunctionalType(sType) && LambdaUtil.isFunctionalType(tType) && !relates(sType, tType)) {
|
||||
if (!isFunctionalTypeMoreSpecific(sType, tType, session, args)) {
|
||||
if (!isFunctionalTypeMoreSpecific(sType, tType, session, args[i])) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
class Test {
|
||||
|
||||
{
|
||||
transform(1, (String l) -> null);
|
||||
}
|
||||
|
||||
public static <I, O> void transform(int input, Function<I, O> function) {
|
||||
System.out.println(input);
|
||||
System.out.println(function);
|
||||
}
|
||||
|
||||
interface IFunction<F, T> {
|
||||
List<T> apply(F var1);
|
||||
}
|
||||
public static <I, O> void transform(int input, IFunction<I, O> function) {
|
||||
System.out.println(input);
|
||||
System.out.println(function);
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIgnoreNonFunctionalArgumentsWhenCheckIfFunctionalMoreSpecific() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user