diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index f446a7fdee0c..8d013b5e187a 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -938,6 +938,8 @@ public class InferenceSession { List newConstraints = new ArrayList(); for (int i = myConstraintIdx; i < myConstraints.size(); i++) { ConstraintFormula constraint = myConstraints.get(i); + //register expression in map to mark as "in progress" + constraint.apply(PsiSubstitutor.EMPTY, true); if (!constraint.reduce(this, newConstraints)) { return false; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CodeBlockLambdaWithoutParamsIsValueCompatibleChecks.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CodeBlockLambdaWithoutParamsIsValueCompatibleChecks.java new file mode 100644 index 000000000000..6f86e34b603a --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CodeBlockLambdaWithoutParamsIsValueCompatibleChecks.java @@ -0,0 +1,20 @@ +class Test { + { + bar(new ThrowableComputable() { + @Override + public String compute() throws Exception { + return foo(); + } + }); + } + + private void bar(ThrowableComputable throwableComputable) {} + + private K foo() throws Exception { + return null; + } + + interface ThrowableComputable { + T compute() throws T1; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java index d6188766f1b8..0a228f54b650 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java @@ -268,6 +268,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase { doTest(); } + public void testCodeBlockLambdaWithoutParamsIsValueCompatibleChecks() throws Exception { + doTest(); + } + private void doTest() { doTest(false); }