mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
lambda: missed ground type for target functional type (IDEA-149053)
This commit is contained in:
@@ -1287,7 +1287,8 @@ public class InferenceSession {
|
||||
if (formula instanceof ExpressionCompatibilityConstraint) {
|
||||
PsiExpression expression = ((ExpressionCompatibilityConstraint)formula).getExpression();
|
||||
if (expression instanceof PsiLambdaExpression) {
|
||||
PsiType parameterType = ((ExpressionCompatibilityConstraint)formula).getT();
|
||||
PsiType parameterType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(((ExpressionCompatibilityConstraint)formula).getT(),
|
||||
(PsiLambdaExpression)expression);
|
||||
collectLambdaReturnExpression(additionalConstraints, (PsiLambdaExpression)expression, parameterType, !isProperType(parameterType), substitutor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
interface I<T, R> {
|
||||
R m(T t);
|
||||
}
|
||||
|
||||
abstract class A<B> {
|
||||
public abstract A<B> bar(I<Throwable, ? extends A<? extends B>> resumeFunction);
|
||||
|
||||
void foo(A<?> a) {
|
||||
a.bar(throwable -> A.error());
|
||||
}
|
||||
|
||||
public static final <T> A<T> error() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testGroundTargetTypeForExpectedReturnTypeOfLambdaExpression() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user