mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
smart completion: detect cases when inference can infer only trivial Object bound (IDEA-153970)
This commit is contained in:
@@ -373,7 +373,7 @@ public class CodeInsightUtil {
|
||||
arg,
|
||||
true,
|
||||
PsiUtil.getLanguageLevel(context));
|
||||
if (PsiType.NULL.equals(substitution) || substitution instanceof PsiWildcardType) continue;
|
||||
if (PsiType.NULL.equals(substitution) || substitution != null && substitution.equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || substitution instanceof PsiWildcardType) continue;
|
||||
if (substitution == null) {
|
||||
result.consume(createType(inheritor, facade.getElementFactory().createRawSubstitutor(inheritor), arrayDim));
|
||||
return true;
|
||||
|
||||
+2
-1
@@ -117,7 +117,8 @@ public class PsiGraphInferenceHelper implements PsiInferenceHelper {
|
||||
leftTypes = new PsiType[] {arg};
|
||||
rightTypes = new PsiType[]{param};
|
||||
}
|
||||
final PsiTypeParameter[] typeParams = new PsiTypeParameter[] {typeParam};
|
||||
final PsiTypeParameterListOwner owner = typeParam.getOwner();
|
||||
final PsiTypeParameter[] typeParams = owner != null ? owner.getTypeParameters() : new PsiTypeParameter[] {typeParam};
|
||||
final InferenceSession inferenceSession = new InferenceSession(typeParams, leftTypes, rightTypes, PsiSubstitutor.EMPTY, myManager, null);
|
||||
if (inferenceSession.isProperType(inferenceSession.substituteWithInferenceVariables(param)) &&
|
||||
inferenceSession.isProperType(inferenceSession.substituteWithInferenceVariables(arg))) {
|
||||
|
||||
-4
@@ -17,12 +17,9 @@ package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.idea.Bombed;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class SmartType18CompletionTest extends LightFixtureCompletionTestCase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
@@ -186,7 +183,6 @@ public void testConvertToObjectStream() {
|
||||
checkResultByFile("/" + getTestName(false) + "-out.java");
|
||||
}
|
||||
|
||||
@Bombed(user = "anna/peter", month = Calendar.MAY, day = 4)
|
||||
public void testOnlyCompatibleTypes() {
|
||||
configureByTestName();
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "get2");
|
||||
|
||||
Reference in New Issue
Block a user