mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
revert additional applicability checks due to captures inside subst
This commit is contained in:
@@ -25,9 +25,7 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
|
||||
import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.ThreeState;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -129,27 +127,15 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
final PsiMethod method = getElement();
|
||||
|
||||
if (isToInferApplicability()) {
|
||||
//ensure applicability check
|
||||
PsiSubstitutor applicabilitySubstitutor = getSubstitutor(false);
|
||||
if (!isOverloadCheck()) {
|
||||
//ensure applicability check is performed
|
||||
getSubstitutor(false);
|
||||
}
|
||||
|
||||
//already performed checks, so if inference failed, error message should be saved
|
||||
if (myInferenceError != null || isPotentiallyCompatible() != ThreeState.YES) {
|
||||
return ApplicabilityLevel.NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
if (myArgumentList instanceof PsiExpressionList) {
|
||||
PsiParameter[] parameters = getElement().getParameterList().getParameters();
|
||||
PsiExpression[] expressions = ((PsiExpressionList)myArgumentList).getExpressions();
|
||||
for (int i = 0; i < expressions.length; i++) {
|
||||
if (!PsiPolyExpressionUtil.isPolyExpression(expressions[i])) {
|
||||
PsiType expressionType = expressions[i].getType();
|
||||
PsiType parameterType = applicabilitySubstitutor.substitute(PsiTypesUtil.getParameterType(parameters, i, isVarargs()));
|
||||
if (expressionType != null && parameterType != null && !parameterType.isAssignableFrom(expressionType)) {
|
||||
return ApplicabilityLevel.NOT_APPLICABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isVarargs() ? ApplicabilityLevel.VARARGS : ApplicabilityLevel.FIXED_ARITY;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ class Calls {
|
||||
void foo(Function<String, Optional> computable) {}
|
||||
|
||||
{
|
||||
((x) -> a(b(c<error descr="'c(C)' in 'Calls' cannot be applied to '(<lambda parameter>)'">(x)</error>)));
|
||||
<error descr="Not a statement">((x) -> a(b(c(x))));</error>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAssignabilityOfStandaloneExpressionsDuringApplicabilityCheck() throws Exception {
|
||||
public void _testAssignabilityOfStandaloneExpressionsDuringApplicabilityCheck() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user