From b54148a6f18d0bae38cc485a9ef99f22489d2fcc Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Tue, 7 Apr 2020 20:06:12 +0300 Subject: [PATCH] Added a test on lateinit var inside a local class --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 +++++ .../box/properties/lateinit/localClass.kt | 17 +++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 +++++ .../codegen/LightAnalysisModeTestGenerated.java | 5 +++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 +++++ .../semantics/IrJsCodegenBoxTestGenerated.java | 5 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 5 +++++ 7 files changed, 47 insertions(+) create mode 100644 compiler/testData/codegen/box/properties/lateinit/localClass.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 287c2e32528..c24242ed0ab 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -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"); diff --git a/compiler/testData/codegen/box/properties/lateinit/localClass.kt b/compiler/testData/codegen/box/properties/lateinit/localClass.kt new file mode 100644 index 00000000000..8acc53d2e64 --- /dev/null +++ b/compiler/testData/codegen/box/properties/lateinit/localClass.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" + } +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 493e3ed1885..4729fadaa98 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index c265592c642..bbd32332d9f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -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"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index a9016586d15..35ffb1c54ef 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -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"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 1cd9f973923..159a4eb157e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -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"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 91b54dcfb19..eb7b4564f6b 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -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");