Add test for KT-19128

It looks like the problem was caused by incorrect merging of
StrictBasicValues and was fixed by commit
904c7f9c64.

 #KT-19128 Fixed
This commit is contained in:
Dmitry Petrov
2017-07-21 11:59:04 +03:00
parent d0c8af5621
commit fda89e9c72
5 changed files with 86 additions and 0 deletions
@@ -0,0 +1,26 @@
class A
class B
class C
fun foo(parameters: Any?): Any? {
var payload: Any? = null
if (parameters != null) {
if (parameters is A || parameters is B) {
payload = parameters
} else {
payload = "O"
}
}
if (payload is String) {
payload += "K"
}
return payload
}
fun box(): String =
"${foo(C())}"
@@ -2709,6 +2709,21 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@TestMetadata("compiler/testData/codegen/box/checkcastOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CheckcastOptimization extends AbstractIrBlackBoxCodegenTest {
public void testAllFilesPresentInCheckcastOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/checkcastOptimization"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("kt19128.kt")
public void testKt19128() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/classLiteral")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2709,6 +2709,21 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@TestMetadata("compiler/testData/codegen/box/checkcastOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CheckcastOptimization extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInCheckcastOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/checkcastOptimization"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("kt19128.kt")
public void testKt19128() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/classLiteral")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2709,6 +2709,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
}
@TestMetadata("compiler/testData/codegen/box/checkcastOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CheckcastOptimization extends AbstractLightAnalysisModeTest {
public void testAllFilesPresentInCheckcastOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/checkcastOptimization"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("kt19128.kt")
public void testKt19128() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/classLiteral")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -3261,6 +3261,21 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/checkcastOptimization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CheckcastOptimization extends AbstractJsCodegenBoxTest {
public void testAllFilesPresentInCheckcastOptimization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/checkcastOptimization"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("kt19128.kt")
public void testKt19128() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/checkcastOptimization/kt19128.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/classLiteral")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)