java inference: tolerate raw upper bound (IDEA-229998)

GitOrigin-RevId: 90a888a80d9bd304fa908e5ae10a52ecc639752d
This commit is contained in:
Anna Kozlova
2021-05-05 22:35:23 +02:00
committed by intellij-monorepo-bot
parent 50c060dd5d
commit 8ccd8d71e4
3 changed files with 13 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ public class StrictSubtypingConstraint implements ConstraintFormula {
if (SClass == null) return false;
if (((PsiClassType)myT).isRaw()) {
if (((PsiClassType)myT).isRaw() || myCapture && sType.isRaw()) {
return InheritanceUtil.isInheritorOrSelf(SClass, CClass, true);
}

View File

@@ -0,0 +1,10 @@
import java.util.List;
class MyTest {
void m(List<? extends Bar> bars) {
n(bars.get(0));
bars.forEach(b -> n(b));
bars.forEach(MyTest::n);
}
private static <T> void n(Bar<T> bar) { }
private static class Bar<T> { }
}

View File

@@ -205,9 +205,8 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
public void testNotInferredVarShouldNotBeUsedForInferenceJava10() { doTest(); }
public void testJavac8UnCaptureBug() { doTest(); }
public void testLambdaInConditional() { doTest(); }
public void testTopLevelParentNoParameters() {
doTest();
}
public void testTopLevelParentNoParameters() { doTest(); }
public void testRawTypeOnTheRight() { doTest(); }
private void doTest() {
doTest(false);