mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
inference: skip standalone expressions in lambda returns (IDEA-171922)
This commit is contained in:
+3
@@ -129,6 +129,9 @@ public class ExpressionCompatibilityConstraint extends InputOutputConstraintForm
|
||||
PsiExpression expression,
|
||||
PsiType targetType,
|
||||
boolean registerErrorOnFailure) {
|
||||
if (!PsiPolyExpressionUtil.isPolyExpression(expression)) {
|
||||
return session;
|
||||
}
|
||||
final PsiExpressionList argumentList = ((PsiCall)expression).getArgumentList();
|
||||
if (argumentList != null) {
|
||||
final MethodCandidateInfo.CurrentCandidateProperties candidateProperties = MethodCandidateInfo.getCurrentMethod(argumentList);
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
class Foo {
|
||||
private static void foo(final Function<String, ?> compose) {
|
||||
Collector<String, ?, ? extends Map<?, ArrayList<String>>> stringMapCollector =
|
||||
Collectors.groupingBy(compose, Collector.of(() -> new ArrayList<String>(), null, null, s -> new ArrayList<>(s)));
|
||||
}
|
||||
}
|
||||
+1
@@ -155,6 +155,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testGroundTargetTypeWhenAbstractMethodInSuperclass() { doTest(); }
|
||||
public void testNestedLambdasWithInferenceOfReturnTypeInTheLatestLambda() { doTest(); }
|
||||
public void testCapturedWildcardNotOpenedDuringInference() { doTest(); }
|
||||
public void testIgnoreStandaloneExpressionsInLambdaReturnForNestedCalls() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
|
||||
Reference in New Issue
Block a user