mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
new inference: don't clear foreign caches - remove only expressions which were added
This commit is contained in:
@@ -1195,7 +1195,9 @@ public class InferenceSession {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
LambdaUtil.ourFunctionTypes.set(null);
|
||||
if (formula instanceof InputOutputConstraintFormula) {
|
||||
LambdaUtil.getFunctionalTypeMap().remove(((InputOutputConstraintFormula)formula).getExpression());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PsiExpression getExpression() {
|
||||
public PsiExpression getExpression() {
|
||||
return myExpression;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.*;
|
||||
*/
|
||||
public abstract class InputOutputConstraintFormula implements ConstraintFormula {
|
||||
|
||||
protected abstract PsiExpression getExpression();
|
||||
public abstract PsiExpression getExpression();
|
||||
protected abstract PsiType getT();
|
||||
protected abstract void setT(PsiType t);
|
||||
protected abstract InputOutputConstraintFormula createSelfConstraint(PsiType type, PsiExpression expression);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
void f(Stream<ReviewDiffRecord> stream1) {
|
||||
final Supplier<List<String>> revisionDiffItemDTOs = () -> stream1.map(record -> {
|
||||
foo(null);
|
||||
final Object stream = record.getAllNodes().stream();
|
||||
return "";
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
private <T> void foo(T t) throws RuntimeException {}
|
||||
|
||||
private class ReviewDiffRecord {
|
||||
List<String> getAllNodes() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,17 +16,13 @@
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Java8ExpressionsCheckTest extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/expressions";
|
||||
@@ -47,6 +43,10 @@ public class Java8ExpressionsCheckTest extends LightDaemonAnalyzerTestCase {
|
||||
doTestAllMethodCallExpressions();
|
||||
}
|
||||
|
||||
public void testProoveThatInferenceInsideLambdaBodyDontInfluenceOuterCallInference() throws Exception {
|
||||
doTestAllMethodCallExpressions();
|
||||
}
|
||||
|
||||
public void testCachedUnresolvedMethods() throws Exception {
|
||||
doTestCachedUnresolved();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user