[TEST] Add test checking cast to DNN type

muted temporary due to required support in backends
This commit is contained in:
Roman Artemev
2021-10-28 12:47:00 +03:00
committed by TeamCityServer
parent 5b19c41373
commit 23ad0e7c63
9 changed files with 61 additions and 0 deletions
@@ -4352,6 +4352,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@Test
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@Test
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
@@ -0,0 +1,17 @@
// !LANGUAGE: +DefinitelyNonNullableTypes
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND_FIR: JVM_IR
fun <T> test(t: T) = t as (T & Any)
fun box(): String {
try {
test<Any?>(null)
} catch (ex: NullPointerException) {
return "FAIL: expected NPE"
}
return test("OK")
}
@@ -4280,6 +4280,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@Test
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@Test
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
@@ -4352,6 +4352,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@Test
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@Test
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
@@ -3686,6 +3686,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Casts extends AbstractLightAnalysisModeTest {
@TestMetadata("castToDefinitelyNotNullType.kt")
public void ignoreCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@@ -2834,6 +2834,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
runTest("compiler/testData/codegen/box/casts/dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt");
@@ -2834,6 +2834,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
runTest("compiler/testData/codegen/box/casts/dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt");
@@ -2824,6 +2824,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {
runTest("compiler/testData/codegen/box/casts/dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt");
@@ -3152,6 +3152,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/casts/castGenericNull.kt");
}
@Test
@TestMetadata("castToDefinitelyNotNullType.kt")
public void testCastToDefinitelyNotNullType() throws Exception {
runTest("compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt");
}
@Test
@TestMetadata("dontCreateInconsistentTypeDuringStarProjectionSubstitution.kt")
public void testDontCreateInconsistentTypeDuringStarProjectionSubstitution() throws Exception {