mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
new inference: substitute resolved vars which e.g. did not participate in initial session (IDEA-123248)
This commit is contained in:
@@ -849,8 +849,7 @@ public class InferenceSession {
|
||||
}
|
||||
|
||||
//resolve input variables
|
||||
PsiSubstitutor substitutor = resolveSubset(varsToResolve, siteSubstitutor);
|
||||
|
||||
PsiSubstitutor substitutor = resolveSubset(varsToResolve, retrieveNonPrimitiveEqualsBounds(getInferenceVariables()).putAll(siteSubstitutor));
|
||||
if (substitutor == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class TypeArgsConsistency {
|
||||
I<Integer> i1 = (i, j) -> i + j;
|
||||
foo((i, j) -> i + j);
|
||||
I<Integer> i2 = bar((i, j) -> i + j);
|
||||
I<Integer> i3 = bar(<error descr="Cyclic inference">(i, j) -> "" + i + j</error>);
|
||||
I<Integer> i3 = bar(<error descr="Incompatible return type String in lambda expression">(i, j) -> "" + i + j</error>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class TypeArgsConsistency2 {
|
||||
I<Integer> i1 = bar(x -> x);
|
||||
I1<Integer> i2 = bar1(x -> 1);
|
||||
I2<String> aI2 = bar2(x -> "");
|
||||
I2<Integer> aI28 = bar2( <error descr="Cyclic inference">x-> ""</error>);
|
||||
I2<Integer> aI28 = bar2( <error descr="Incompatible return type String in lambda expression">x-> ""</error>);
|
||||
I2<Integer> i3 = bar2(x -> x);
|
||||
I2<Integer> i4 = bar2(x -> foooI());
|
||||
System.out.println(i4.foo(2));
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class App {
|
||||
|
||||
void foo(Stream<Integer> boxed) {
|
||||
final Map<Integer, Integer> count = boxed.collect(HashMap::new, null, HashMap::putAll);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -221,6 +221,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA123248() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user