Refine subtyping check: pay attention to corresponding supertype nullability

F: Any, T : F? => !isSubtype(T, Any)

It helps to identify upper bounds violation like in KT-7455

 #KT-7455 Fixed
 #KT-2924 Fixed
 #KT-3015 Fixed
This commit is contained in:
Denis Zharkov
2015-08-26 11:22:40 +03:00
parent a906be6dd7
commit 6ecfa6e985
11 changed files with 184 additions and 3 deletions
@@ -6137,11 +6137,35 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/generics/nullability"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("declarationsBoundsViolation.kt")
public void testDeclarationsBoundsViolation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/nullability/declarationsBoundsViolation.kt");
doTest(fileName);
}
@TestMetadata("expressionsBoundsViolation.kt")
public void testExpressionsBoundsViolation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.kt");
doTest(fileName);
}
@TestMetadata("nullToGeneric.kt")
public void testNullToGeneric() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/nullability/nullToGeneric.kt");
doTest(fileName);
}
@TestMetadata("tpBoundsViolation.kt")
public void testTpBoundsViolation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/nullability/tpBoundsViolation.kt");
doTest(fileName);
}
@TestMetadata("useAsValueArgument.kt")
public void testUseAsValueArgument() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/nullability/useAsValueArgument.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/tests/generics/starProjections")