mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inference: skip bounds checking for captured fresh variables (IDEA-187943)
This commit is contained in:
+1
@@ -1032,6 +1032,7 @@ public class InferenceSession {
|
||||
final PsiSubstitutor substitutor) {
|
||||
for (InferenceVariable typeParameter : typeParams) {
|
||||
if (typeParameter.getInstantiation() != PsiType.NULL) continue;
|
||||
if (typeParameter.getUserData(ORIGINAL_CAPTURE) != null) continue;
|
||||
final PsiType type = substitutor.substitute(typeParameter);
|
||||
if (type instanceof PsiClassType) {
|
||||
final PsiClass aClass = ((PsiClassType)type).resolve();
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.Function;
|
||||
|
||||
abstract class Initial<A, B> {
|
||||
|
||||
abstract <A1> Initial<A1, B> leftMap(Function<? super A, ? extends A1> leftTransform);
|
||||
|
||||
abstract <A1, B1> Initial<A1, ?> leftFlatMap(Function<? super A, ? extends Initial<? extends A1, ? extends B1>> leftTransform);
|
||||
|
||||
|
||||
public void testThingy(final Initial<Integer, Double> left23,
|
||||
final Initial<Integer, Double> left42,
|
||||
final Initial<Integer, Double> left57) {
|
||||
final Initial<Integer, ?> r2 = left23.leftFlatMap(i -> left42.leftFlatMap(j -> left57.leftMap(k -> i + j + k)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//simplified
|
||||
abstract class Either<A, B> {
|
||||
abstract <A1, B1> void first(Supplier<Either<A1, ? extends B1>> leftTransform);
|
||||
abstract <A2, B2> Either<A2, ?> second(Supplier<Either<A2, ? extends B2>> leftTransform);
|
||||
abstract <A3> Either<A3, B> third(Supplier<A3> leftTransform);
|
||||
|
||||
public void test(A a) {
|
||||
first(() -> second(() -> third(() -> a)));
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -162,6 +162,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testLambdaWithFormalTypeParameters() { doTest(); }
|
||||
public void testIDEA174924() { doTest(); }
|
||||
public void testVoidValueCompatibilityWithBreakInSwitch() { doTest(); }
|
||||
public void testLambdaChainWithCapturedWildcards() { doTest(); }
|
||||
public void testExceptionInferenceForVarargMethods() { doTest(); }
|
||||
public void testConditionalBooleanAsFunctionalInterfaceType() { doTest(); }
|
||||
public void testUnhandledExceptionInLambdaChain() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user