Codegen test for smart cast to Nothing?

This commit is contained in:
Mikhail Glukhikh
2015-11-25 15:00:58 +03:00
parent 9a6d4c32c5
commit a53ad098d6
2 changed files with 14 additions and 0 deletions
@@ -0,0 +1,8 @@
fun String?.foo() = this ?: "OK"
fun foo(i: Int?): String {
if (i == null) return i.foo()
return "$i"
}
fun box() = foo(null)
@@ -7305,6 +7305,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/smartCasts/implicitToGrandSon.kt");
doTest(fileName);
}
@TestMetadata("nullSmartCast.kt")
public void testNullSmartCast() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/smartCasts/nullSmartCast.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/specialBuiltins")