lambda: accept? inference variables as target type for lambda expression during lambda constraint reduction (IDEA-136435)

This commit is contained in:
Anna Kozlova
2015-02-12 21:15:32 +01:00
parent 8a4501b911
commit 344379d2f4
3 changed files with 18 additions and 0 deletions
@@ -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;
}
@@ -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;
}
}
@@ -99,6 +99,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testNestedLambdaWithInferenceVariableAsTargetType() throws Exception {
doTest();
}
public void testIDEA127596() throws Exception {
doTest();
}