diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index ba58f4e48a3d..1addc14dfc38 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -1984,8 +1984,8 @@ public class InferenceSession { final PsiSubstitutor sSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(gClass, (PsiClassType)sBound); final PsiSubstitutor tSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(gClass, (PsiClassType)tBound); for (PsiTypeParameter typeParameter : gClass.getTypeParameters()) { - final PsiType sType = sSubstitutor.substitute(typeParameter); - final PsiType tType = tSubstitutor.substitute(typeParameter); + final PsiType sType = sSubstitutor.substituteWithBoundsPromotion(typeParameter); + final PsiType tType = tSubstitutor.substituteWithBoundsPromotion(typeParameter); final Pair typePair = Pair.create(sType, tType); if (!processor.process(typePair)) { return gClass; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/ValidIntersectionTypeWithCapturedBounds.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/ValidIntersectionTypeWithCapturedBounds.java new file mode 100644 index 000000000000..d66c2f810a19 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/ValidIntersectionTypeWithCapturedBounds.java @@ -0,0 +1,11 @@ + +abstract class Bug { + { + D _m = m(); + } + + abstract > J m(); +} + +abstract class C { } +abstract class D extends C { } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java index 2c09c1102be5..645a9442f600 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java @@ -115,6 +115,7 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase public void testPullUncheckedWarningNotionThroughNestedCalls() { doTest(); } public void testIDEA149774() { doTest(); } public void testDisjunctionTypes() { doTest(); } + public void testValidIntersectionTypeWithCapturedBounds() { doTest(); } public void testPushErasedStateToArguments() { doTest(); } public void testStopAtStandaloneConditional() { doTest(); } public void testTransitiveInferenceVariableDependencies() { doTest(); }