new inference: substitute resolved vars which e.g. did not participate in initial session (IDEA-123248)

This commit is contained in:
Anna Kozlova
2014-04-01 13:52:44 +02:00
parent 5518b93bd2
commit d33575878b
4 changed files with 18 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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));

View File

@@ -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);
}
}

View File

@@ -221,6 +221,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testIDEA123248() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}