mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
overload resolution: erase type of parameter when site substitutor is raw (IDEA-203450)
similar to erasure of call type when inferred substitutor is raw
This commit is contained in:
@@ -1720,6 +1720,9 @@ public class InferenceSession {
|
||||
for (int i = 0; i < paramsLength; i++) {
|
||||
PsiType sType = getParameterType(parameters1, i, siteSubstitutor1, false);
|
||||
PsiType tType = session.substituteWithInferenceVariables(getParameterType(parameters2, i, siteSubstitutor1, varargs));
|
||||
if (PsiUtil.isRawSubstitutor(m2, siteSubstitutor1)) {
|
||||
tType = TypeConversionUtil.erasure(tType);
|
||||
}
|
||||
if (sType instanceof PsiClassType &&
|
||||
tType instanceof PsiClassType &&
|
||||
LambdaUtil.isFunctionalType(sType) && LambdaUtil.isFunctionalType(tType) && !relates(sType, tType)) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
class TestCaller1<P1> {
|
||||
{
|
||||
TestCaller1.foo(null);
|
||||
}
|
||||
public static void foo(HashSet<Integer> fn) { }
|
||||
public <P> void foo(Set<String> fn) { }
|
||||
}
|
||||
|
||||
class TestCaller2 {
|
||||
{
|
||||
TestCaller2.foo<error descr="Ambiguous method call: both 'TestCaller2.foo(HashSet<Integer>)' and 'TestCaller2.foo(Set<String>)' match">(null)</error>;
|
||||
}
|
||||
public static void foo(HashSet<Integer> fn) { }
|
||||
public <P> void foo(Set<String> fn) { }
|
||||
}
|
||||
|
||||
class TestCaller3 {
|
||||
{
|
||||
TestCaller2.foo<error descr="Ambiguous method call: both 'TestCaller2.foo(HashSet<Integer>)' and 'TestCaller2.foo(Set<String>)' match">(null)</error>;
|
||||
}
|
||||
public static void foo(HashSet<Integer> fn) { }
|
||||
public static void foo(Set<String> fn) { }
|
||||
}
|
||||
@@ -270,6 +270,8 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
public void testOverriddenMethodWithOtherRawSignature() { doTest(false);}
|
||||
|
||||
public void testMoreSpecificForRawSignatureOnStaticProblem() { doTest(false);}
|
||||
|
||||
public void testUnqualifiedStaticInterfaceMethodCallsOnInnerClasses() { doTest(false);}
|
||||
|
||||
public void testStaticMethodInSuperInterfaceConflictWithCurrentStatic() { doTest(false);}
|
||||
|
||||
Reference in New Issue
Block a user