Minor, add test case on SAM conversion over smart cast

This commit is contained in:
Alexander Udalov
2019-08-09 19:21:22 +02:00
parent dd0e296af1
commit ad43bc23ea
4 changed files with 29 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// TARGET_BACKEND: JVM
fun test(a: Any?) {
a as () -> Unit
Runnable(a).run()
}
fun box(): String {
var result = "Fail"
test {
result = "OK"
}
return result
}
@@ -23336,6 +23336,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("castFromAny.kt")
public void testCastFromAny() throws Exception {
runTest("compiler/testData/codegen/box/sam/castFromAny.kt");
}
@TestMetadata("kt17091.kt")
public void testKt17091() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt17091.kt");
@@ -23336,6 +23336,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("castFromAny.kt")
public void testCastFromAny() throws Exception {
runTest("compiler/testData/codegen/box/sam/castFromAny.kt");
}
@TestMetadata("kt17091.kt")
public void testKt17091() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt17091.kt");
@@ -22236,6 +22236,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/sam"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("castFromAny.kt")
public void testCastFromAny() throws Exception {
runTest("compiler/testData/codegen/box/sam/castFromAny.kt");
}
@TestMetadata("kt17091.kt")
public void testKt17091() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt17091.kt");