new inference: lift also unknown vars (IDEA-117530)

This commit is contained in:
Anna Kozlova
2014-02-18 21:23:13 +01:00
parent 88d220f95d
commit 54bfa05e5e
3 changed files with 49 additions and 1 deletions

View File

@@ -1147,13 +1147,16 @@ public class InferenceSession {
public void liftBounds(Collection<InferenceVariable> variables) {
for (InferenceVariable variable : variables) {
final InferenceVariable inferenceVariable = getInferenceVariable(variable.getParameter());
final PsiTypeParameter parameter = variable.getParameter();
final InferenceVariable inferenceVariable = getInferenceVariable(parameter);
if (inferenceVariable != null) {
for (InferenceBound boundType : InferenceBound.values()) {
for (PsiType bound : variable.getBounds(boundType)) {
inferenceVariable.addBound(bound, boundType);
}
}
} else {
myInferenceVariables.put(parameter, variable);
}
}
}

View File

@@ -0,0 +1,41 @@
import java.util.Map;
abstract class Test<Tt> {
public Map<String, Long> getNumberOfInstancesForEachWord() {
return collect(groupingBy(counting()));
}
abstract <R> R collect(Collector<? super Tt, R> collector);
abstract <Tg, M> Collector<Tg, M> groupingBy(Collector<? super Tg, Long> downstream);
abstract <Tc> Collector<Tc, Long> counting();
interface Collector<T, R> {}
}
abstract class Test1<Tt> {
public Map<String, Long> getNumberOfInstancesForEachWord() {
return collect(groupingBy(counting()));
}
abstract <R> R collect(Collector<Tt, R> collector);
abstract <Tg, M> Collector<Tg, M> groupingBy(Collector<Tg, Long> downstream);
abstract <Tc> Collector<Tc, Long> counting();
interface Collector<T, R> {}
}
abstract class Test2<Tt> {
public Map<String, Long> getNumberOfInstancesForEachWord() {
return collect(groupingBy(counting()));
}
abstract <R> R collect(Collector<Tt, R> collector);
abstract <Tg, M> Collector<Tg, M> groupingBy(Collector<? extends Tg, Long> downstream);
abstract <Tc> Collector<Tc, Long> counting();
interface Collector<T, R> {}
}

View File

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