mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
revert inference for all type arguments for now (IDEA-153970 Code completion suggestions for SmartType are broken when used with generics)
This commit is contained in:
+1
-2
@@ -117,8 +117,7 @@ public class PsiGraphInferenceHelper implements PsiInferenceHelper {
|
||||
leftTypes = new PsiType[] {arg};
|
||||
rightTypes = new PsiType[]{param};
|
||||
}
|
||||
final PsiTypeParameterListOwner owner = typeParam.getOwner();
|
||||
final PsiTypeParameter[] typeParams = owner != null ? owner.getTypeParameters() : new PsiTypeParameter[] {typeParam};
|
||||
final PsiTypeParameter[] typeParams = 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))) {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
{
|
||||
Map<String, String> m = new HashMap<>(<caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.*;
|
||||
|
||||
class A {
|
||||
{
|
||||
Map<String, String> m = new HashM<caret>
|
||||
}
|
||||
}
|
||||
+8
@@ -17,9 +17,12 @@ 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() {
|
||||
@@ -183,8 +186,13 @@ 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");
|
||||
}
|
||||
|
||||
public void testSuggestMapInheritors() { doTest(); }
|
||||
|
||||
public void testUnboundTypeArgs() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user