diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 09aa2cd302d..f7d288f1c07 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -29217,6 +29217,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/properties/lateinit/kt30548.kt"); } + @Test + @TestMetadata("kt46267.kt") + public void testKt46267() throws Exception { + runTest("compiler/testData/codegen/box/properties/lateinit/kt46267.kt"); + } + @Test @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt index 657ca8b313f..098e88d11e2 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.backend.common.CommonBackendContext import org.jetbrains.kotlin.backend.common.DefaultMapping import org.jetbrains.kotlin.backend.common.Mapping import org.jetbrains.kotlin.backend.common.ir.Ir -import org.jetbrains.kotlin.backend.common.lower.irThrow import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig import org.jetbrains.kotlin.backend.common.psi.PsiErrorBuilder import org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen @@ -29,7 +28,6 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope import org.jetbrains.kotlin.ir.builders.irBlock -import org.jetbrains.kotlin.ir.builders.irNull import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns @@ -161,7 +159,6 @@ class JvmBackendContext( override fun throwUninitializedPropertyAccessException(builder: IrBuilderWithScope, name: String): IrExpression = builder.irBlock { +super.throwUninitializedPropertyAccessException(builder, name) - +irThrow(irNull()) } override fun handleDeepCopy( diff --git a/compiler/testData/codegen/box/properties/lateinit/kt46267.kt b/compiler/testData/codegen/box/properties/lateinit/kt46267.kt new file mode 100644 index 00000000000..d58a857d105 --- /dev/null +++ b/compiler/testData/codegen/box/properties/lateinit/kt46267.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM + +// CHECK_BYTECODE_TEXT +// 0 ATHROW +// -- invoking throwUninitializedPropertyAccessException is enough + +class Test { + private lateinit var z: String + + fun test(): String { + z = "OK" + return z + } +} + +fun box(): String { + return Test().test() +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index cc30256f030..2ef7e753ad0 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -29181,6 +29181,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/properties/lateinit/kt30548.kt"); } + @Test + @TestMetadata("kt46267.kt") + public void testKt46267() throws Exception { + runTest("compiler/testData/codegen/box/properties/lateinit/kt46267.kt"); + } + @Test @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index d2017d947e0..7eadfaf98e3 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -29217,6 +29217,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/properties/lateinit/kt30548.kt"); } + @Test + @TestMetadata("kt46267.kt") + public void testKt46267() throws Exception { + runTest("compiler/testData/codegen/box/properties/lateinit/kt46267.kt"); + } + @Test @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index c66fe55a33b..1bb9fa95598 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -24797,6 +24797,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/properties/lateinit/exceptionGetter.kt"); } + @TestMetadata("kt46267.kt") + public void testKt46267() throws Exception { + runTest("compiler/testData/codegen/box/properties/lateinit/kt46267.kt"); + } + @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { runTest("compiler/testData/codegen/box/properties/lateinit/localClass.kt");