Added a test on lateinit var inside a local class

This commit is contained in:
Igor Chevdar
2020-04-07 20:06:12 +03:00
parent 1772f20d48
commit b54148a6f1
7 changed files with 47 additions and 0 deletions
@@ -18966,6 +18966,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");
}
@TestMetadata("nameClash.kt")
public void testNameClash() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/nameClash.kt");
@@ -0,0 +1,17 @@
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR, JS_IR
import kotlin.UninitializedPropertyAccessException
fun box(): String {
val o = object {
lateinit var x: Any
}
try {
if (o.x == null) return "fail 1"
return "fail 2"
} catch (t: UninitializedPropertyAccessException) {
return "OK"
}
}
@@ -20527,6 +20527,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");
}
@TestMetadata("nameClash.kt")
public void testNameClash() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/nameClash.kt");
@@ -20527,6 +20527,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");
}
@TestMetadata("nameClash.kt")
public void testNameClash() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/nameClash.kt");
@@ -18966,6 +18966,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");
}
@TestMetadata("nameClash.kt")
public void testNameClash() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/nameClash.kt");
@@ -15872,6 +15872,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");
}
@TestMetadata("nameClash.kt")
public void testNameClash() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/nameClash.kt");
@@ -15977,6 +15977,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");
}
@TestMetadata("nameClash.kt")
public void testNameClash() throws Exception {
runTest("compiler/testData/codegen/box/properties/lateinit/nameClash.kt");