new inference: postpone unresolved variables in favor to variables with proper equals bound

This commit is contained in:
Anna.Kozlova
2016-10-11 10:26:21 +02:00
parent 80c888528e
commit 41c2429966
3 changed files with 21 additions and 0 deletions

View File

@@ -1121,6 +1121,10 @@ public class InferenceSession {
unresolved.add(var);
}
}
if (!unresolved.isEmpty() && vars.size() > unresolved.size()) {
vars.removeAll(unresolved);
vars.addAll(unresolved);
}
if (!myIncorporationPhase.hasCaptureConstraints(unresolved)) {
PsiSubstitutor firstSubstitutor = resolveSubset(vars, substitutor);
if (hasBoundProblems(vars, firstSubstitutor)) {

View File

@@ -0,0 +1,13 @@
import java.util.Comparator;
import java.util.function.Supplier;
class Test {
void f(Supplier<Comparable> m) {
g(m, Comparator.naturalOrder());
}
<K> void g(Supplier<K> f, Comparator<K> c) {}
}

View File

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