mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new inference: stop collecting constraints if target type is proper (IDEA-136412)
This commit is contained in:
+1
-1
@@ -308,7 +308,7 @@ public class InferenceSession {
|
||||
if (calledMethod != null && PsiPolyExpressionUtil.isMethodCallPolyExpression(arg, calledMethod)) {
|
||||
collectAdditionalConstraints(additionalConstraints, (PsiCallExpression)arg);
|
||||
}
|
||||
} else if (arg instanceof PsiLambdaExpression) {
|
||||
} else if (arg instanceof PsiLambdaExpression && !isProperType(retrieveNonPrimitiveEqualsBounds(myInferenceVariables).substitute(parameterType))) {
|
||||
collectLambdaReturnExpression(additionalConstraints, (PsiLambdaExpression)arg, parameterType);
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
private List<Map<String, String>> foo(Stream<Map.Entry<String, List<String>>> stream) {
|
||||
return then(v -> stream.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().toString())));
|
||||
}
|
||||
|
||||
private <V> List<V> then(Function<Void, V> f) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
@@ -28,6 +28,10 @@ public class NewInferenceCollectingAdditionalConstraintsTest extends LightDaemon
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStopCollectingAdditionalConstraintsWhenLambdaReturnTypeIsProper() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user