From e7c7fab136702029f3e7c54acf77aebc6e915fc3 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 2 Feb 2016 20:02:20 +0300 Subject: [PATCH] stop at lambda also if it is explicitly typed EA-78231 - SOE: InferenceSessionContainer.infer --- .../graphInference/InferenceSession.java | 2 ++ ...aWithoutParamsIsValueCompatibleChecks.java | 20 +++++++++++++++++++ .../lambda/NewLambdaHighlightingTest.java | 4 ++++ 3 files changed, 26 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/CodeBlockLambdaWithoutParamsIsValueCompatibleChecks.java 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); }