mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
if client iterates through candidates of call resolve results and start inference for one of them, then cached top level session should be rejected if it corresponds to another candidate
This commit is contained in:
+20
@@ -20,6 +20,8 @@ import com.intellij.codeInsight.ExpectedTypesProvider;
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.infos.MethodCandidateInfo;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -88,6 +90,24 @@ public class Java8ExpressionsCheckTest extends LightDaemonAnalyzerTestCase {
|
||||
doTestConfiguredFile(false, false, filePath);
|
||||
}
|
||||
|
||||
public void testRejectCachedTopLevelSessionIfItCorrespondsToTheWrongOverload() throws Exception {
|
||||
final String filePath = BASE_PATH + "/" + getTestName(false) + ".java";
|
||||
configureByFile(filePath);
|
||||
PsiMethodCallExpression methodCall =
|
||||
PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiMethodCallExpression.class);
|
||||
assertNotNull(methodCall);
|
||||
final PsiResolveHelper helper = JavaPsiFacade.getInstance(methodCall.getProject()).getResolveHelper();
|
||||
CandidateInfo[] candidates = helper.getReferencedMethodCandidates(methodCall, false, true);
|
||||
for (CandidateInfo candidate : candidates) {
|
||||
if (candidate instanceof MethodCandidateInfo) {
|
||||
//try to cache top level session
|
||||
candidate.getSubstitutor();
|
||||
}
|
||||
}
|
||||
|
||||
doTestConfiguredFile(false, false, filePath);
|
||||
}
|
||||
|
||||
private void doTestCachedUnresolved() {
|
||||
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
|
||||
PsiMethodCallExpression callExpression =
|
||||
|
||||
Reference in New Issue
Block a user