mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
new inference: lambda compatibility: ground type constraint added
This commit is contained in:
+1
@@ -45,6 +45,7 @@ public class LambdaExpressionCompatibilityConstraint implements ConstraintFormul
|
||||
for (int i = 0; i < lambdaParameters.length; i++) {
|
||||
constraints.add(new TypeEqualityConstraint(lambdaParameters[i].getType(), substitutor.substitute(parameters[i].getType())));
|
||||
}
|
||||
constraints.add(new StrictSubtypingConstraint(myT, groundTargetType));
|
||||
} else {
|
||||
for (PsiParameter parameter : parameters) {
|
||||
if (!session.isProperType(substitutor.substitute(parameter.getType()))) {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import java.util.List;
|
||||
|
||||
public class Sample {
|
||||
interface Fun<A extends List <String>, B> {
|
||||
B f(A a);
|
||||
}
|
||||
|
||||
<T, R> void foo(Fun<? super T , R> f) {}
|
||||
|
||||
{
|
||||
foo((List<String> ls) -> ls.size());
|
||||
}
|
||||
}
|
||||
+4
@@ -50,6 +50,10 @@ public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testLambdaGroundTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
private void doTest(final boolean checkWarnings) {
|
||||
doTestNewInference(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user