new inference: pull erased flag through nested calls (IDEA-133613)

This commit is contained in:
Anna Kozlova
2015-12-28 17:31:41 +01:00
parent 5463bad1ab
commit adaa0f09b7
4 changed files with 41 additions and 2 deletions

View File

@@ -1810,4 +1810,8 @@ public class InferenceSession {
public List<String> getIncompatibleErrorMessages() {
return myErrorMessages;
}
public boolean isErased() {
return myErased;
}
}

View File

@@ -56,8 +56,14 @@ public class ExpressionCompatibilityConstraint extends InputOutputConstraintForm
return false;
}
if (exprType instanceof PsiClassType && ((PsiClassType)exprType).resolve() == null) {
return true;
if (exprType instanceof PsiClassType) {
if (((PsiClassType)exprType).resolve() == null) {
return true;
}
if (((PsiClassType)exprType).isRaw()) {
session.setErased();
}
}
if (exprType != null && exprType != PsiType.NULL) {
@@ -94,6 +100,9 @@ public class ExpressionCompatibilityConstraint extends InputOutputConstraintForm
if (callSession != session) {
session.getInferenceSessionContainer().registerNestedSession(callSession);
session.propagateVariables(callSession.getInferenceVariables());
if (callSession.isErased()) {
session.setErased();
}
}
return true;
}

View File

@@ -0,0 +1,22 @@
import java.util.List;
class Temp<K> {
public static List<String> foo() {
return parallelizePairs(asList(new Tuple())).partitionBy();
}
public static <T> List<T> asList(T a) {
return null;
}
public static <K> Temp<K> parallelizePairs(List<Tuple<K>> list) {
return null;
}
public List<K> partitionBy() { return null; }
}
class Tuple<A> {
public Tuple() {}
}

View File

@@ -351,6 +351,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testPullUncheckedWarningNotionThroughNestedCalls() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}