mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
new inference: postpone unresolved variables in favor to variables with proper equals bound
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
}
|
||||
@@ -482,6 +482,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPostponeUnresolvedVariables() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user