mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambda: accept? inference variables as target type for lambda expression during lambda constraint reduction (IDEA-136435)
This commit is contained in:
+3
@@ -22,6 +22,9 @@ public class LambdaExpressionCompatibilityConstraint implements ConstraintFormul
|
||||
|
||||
@Override
|
||||
public boolean reduce(InferenceSession session, List<ConstraintFormula> constraints) {
|
||||
if (session.getInferenceVariable(myT) != null) {
|
||||
return true;
|
||||
}
|
||||
if (!LambdaUtil.isFunctionalType(myT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class Test {
|
||||
{
|
||||
Supplier<Runnable> x = foo(() -> () -> {});
|
||||
}
|
||||
|
||||
static <T> Supplier<T> foo(Supplier<T> delegate) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
@@ -99,6 +99,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNestedLambdaWithInferenceVariableAsTargetType() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA127596() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user