mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
static imports: don't compare with expected type when it depends on unresolved reference (IDEA-163072)
This commit is contained in:
@@ -988,7 +988,7 @@ public class ExpectedTypesProvider {
|
||||
final MethodCandidateInfo info = (MethodCandidateInfo)candidateInfo;
|
||||
substitutor = MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(argumentList, false,
|
||||
() -> info.inferSubstitutorFromArgs(policy, args));
|
||||
if (!info.isStaticsScopeCorrect() && !method.hasModifierProperty(PsiModifier.STATIC)) continue;
|
||||
if (!info.isStaticsScopeCorrect() && !method.hasModifierProperty(PsiModifier.STATIC) || info.getInferenceErrorMessage() != null) continue;
|
||||
}
|
||||
else {
|
||||
substitutor = MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(argumentList, false, candidateInfo::getSubstitutor);
|
||||
|
||||
@@ -184,8 +184,12 @@ public class ExpressionCompatibilityConstraint extends InputOutputConstraintForm
|
||||
session.registerIncompatibleErrorMessage(message);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
session.registerIncompatibleErrorMessage("Failed to resolve argument");
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import java.util.*;
|
||||
class Main {
|
||||
|
||||
void foo(List<Integer> list) {
|
||||
bar(list, i -> i.intValue(), i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
|
||||
bar1(list, i -> i.intValue(), i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
|
||||
bar(list, <error descr="Failed to resolve argument">i -> i.intValue()</error>, i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
|
||||
bar1(list, <error descr="Failed to resolve argument">i -> i.intValue()</error>, i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
|
||||
}
|
||||
|
||||
<U, S_IN, S_OUT, R> R bar(List<S_IN> list,
|
||||
|
||||
@@ -48,7 +48,7 @@ class Test2 {
|
||||
{
|
||||
Class c = D.class;
|
||||
|
||||
D<String> d = new D<>(s -> s.<error descr="Cannot resolve method 'isEmpty()'">isEmpty</error>(), c);
|
||||
D<String> d = new D<error descr="Cannot infer arguments"><></error>(s -> s.<error descr="Cannot resolve method 'isEmpty()'">isEmpty</error>(), c);
|
||||
D<String> d1 = D.create(s -> s.<error descr="Cannot resolve method 'isEmpty()'">isEmpty</error>(), c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// "Import static method 'java.util.stream.Collectors.toList'" "true"
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
public class X {
|
||||
|
||||
{
|
||||
System.out.println(Stream.of(123, 456)
|
||||
.map(i -> i + 1)
|
||||
.collect(toList()));
|
||||
}
|
||||
}
|
||||
|
||||
class Y {
|
||||
private static void toList() {}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Import static method 'java.util.stream.Collectors.toList'" "true"
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class X {
|
||||
|
||||
{
|
||||
System.out.println(Stream.of(123, 456)
|
||||
.map(i -> i + 1)
|
||||
.collect(toLi<caret>st()));
|
||||
}
|
||||
}
|
||||
|
||||
class Y {
|
||||
private static void toList() {}
|
||||
}
|
||||
Reference in New Issue
Block a user