mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
don't calculate type of method expression which is located on the left side of assignment - assignment is invalid anyway
(EA-77049 - assert: PsiMethodCallExpressionImpl$TypeEvaluator.fun)
This commit is contained in:
@@ -161,9 +161,9 @@ public class PsiMethodCallExpressionImpl extends ExpressionPsiElement implements
|
||||
final JavaResolveResult[] results = methodExpression.multiResolve(false);
|
||||
LanguageLevel languageLevel = PsiUtil.getLanguageLevel(call);
|
||||
|
||||
final PsiElement callParent = PsiUtil.skipParenthesizedExprUp(call.getParent());
|
||||
final PsiExpressionList parentArgList;
|
||||
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
|
||||
final PsiElement callParent = PsiUtil.skipParenthesizedExprUp(call.getParent());
|
||||
parentArgList = callParent instanceof PsiConditionalExpression && !PsiPolyExpressionUtil.isPolyExpression((PsiExpression)callParent)
|
||||
? null : PsiTreeUtil.getParentOfType(call, PsiExpressionList.class);
|
||||
}
|
||||
@@ -177,6 +177,9 @@ public class PsiMethodCallExpressionImpl extends ExpressionPsiElement implements
|
||||
final JavaResolveResult candidateInfo = results[i];
|
||||
|
||||
if (genericMethodCall && PsiPolyExpressionUtil.isMethodCallPolyExpression(call, (PsiMethod)candidateInfo.getElement())) {
|
||||
if (callParent instanceof PsiAssignmentExpression) {
|
||||
return null;
|
||||
}
|
||||
LOG.error("poly expression evaluation during overload resolution");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
class Test {
|
||||
|
||||
public void myMethod()
|
||||
{
|
||||
foo ( <error descr="Variable expected">bar("")</error> = "");
|
||||
}
|
||||
|
||||
private <T> T foo(final T bar) {
|
||||
return null;
|
||||
}
|
||||
private <T> T foo(final String bar) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private <S> S bar(final String s) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -433,6 +433,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPolyMethodCallOnLeftSideOfAssignment() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVariableNamesOfNestedCalls() throws Exception {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
String filePath = BASE_PATH + "/" + getTestName(false) + ".java";
|
||||
|
||||
Reference in New Issue
Block a user