new inference: accept inferred equals bounds even when additional constraints lead to failure to get more appropriate error message (IDEA-139275)

This commit is contained in:
Anna Kozlova
2015-04-16 20:30:29 +02:00
parent 2275db374b
commit fd11949634
3 changed files with 16 additions and 1 deletions
@@ -269,7 +269,7 @@ public class InferenceSession {
}
if (!additionalConstraints.isEmpty() && !proceedWithAdditionalConstraints(additionalConstraints)) {
return prepareSubstitution();
return prepareSubstitution().putAll(retrieveNonPrimitiveEqualsBounds(myInferenceVariables));
}
}
}
@@ -0,0 +1,11 @@
import java.io.Reader;
import java.util.Arrays;
import java.util.function.Consumer;
class Test {
public static void main(String[] args) {
Iterable<Consumer<Reader>> i = Arrays.asList((r) -> <error descr="Unhandled exception: java.io.IOException">r.read()</error>);
Iterable<Consumer<Reader>> i1 = Arrays.<Consumer<Reader>>asList((r) -> <error descr="Unhandled exception: java.io.IOException">r.read()</error>);
}
}
@@ -189,6 +189,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testAcceptInferredVariablesBeforeAdditionalConstraintsLeadToFail() throws Exception {
doTest(false);
}
private void doTest() {
doTest(false);
}