intersection type validation fixed (IDEA-173900)

take type parameter bounds into account
This commit is contained in:
Anna Kozlova
2017-06-05 14:34:18 +03:00
parent 5e2ab00618
commit 377520ade5
3 changed files with 14 additions and 2 deletions
@@ -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<PsiType, PsiType> typePair = Pair.create(sType, tType);
if (!processor.process(typePair)) {
return gClass;
@@ -0,0 +1,11 @@
abstract class Bug {
{
D<?> _m = m();
}
abstract <J extends C<? extends String>> J m();
}
abstract class C<T extends String> { }
abstract class D<T extends String> extends C<T> { }
@@ -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(); }