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:
peter
2016-04-05 14:29:08 +02:00
parent d81fe6158e
commit f2ef7b87c1
4 changed files with 23 additions and 2 deletions
@@ -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))) {
@@ -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>
}
}
@@ -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(); }
}