mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambda: do not override already inferred types from parent (IDEA-92733)
This commit is contained in:
+4
-1
@@ -993,7 +993,10 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
if (method == null || methodParamsDependOn(typeParameter, expression,
|
||||
functionalInterfaceType, method.getParameterList().getParameters(),
|
||||
LambdaUtil.getSubstitutor(method, resolveResult))) {
|
||||
return getFailedInferenceConstraint(typeParameter);
|
||||
if (expression instanceof PsiMethodReferenceExpression) {
|
||||
return getFailedInferenceConstraint(typeParameter);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
class LambdaTest {
|
||||
|
||||
public void highlightsTheBug(Stream<String> stream) {
|
||||
stream.flatMap((Block<? super String> sink, String element) -> {});
|
||||
}
|
||||
|
||||
public interface Block<B> {
|
||||
void apply(B t);
|
||||
}
|
||||
|
||||
public interface Stream<S> {
|
||||
<R> Stream<R> flatMap(FlatMapper<? super S, R> mapper);
|
||||
|
||||
}
|
||||
|
||||
public interface FlatMapper<F, R> {
|
||||
void flatMapInto(Block<? super R> sink, F element);
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -152,7 +152,11 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testRecursiveAccess() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testIncompatibleFormalParameterTypes() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user