mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 05:21:29 +07:00
new inference: lift also unknown vars (IDEA-117530)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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> {}
|
||||
}
|
||||
@@ -132,6 +132,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDeepCallsChain() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user