diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index df822fba877..ad40013814e 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -52977,6 +52977,18 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longCondition.kt") public void testLongCondition() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index cf5626e89dc..b5ffaa65fd7 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -52977,6 +52977,18 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longCondition.kt") public void testLongCondition() throws Exception { diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index dd0b8ad140d..f3451bd9cbe 100644 --- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -792,6 +792,7 @@ class ExpressionCodegen( declaration.markLineNumber(startOffset = true) mv.store(index, varType) } else if (declaration.isVisibleInLVT) { + declaration.markLineNumber(startOffset = true) pushDefaultValueOnStack(varType, mv) mv.store(index, varType) } diff --git a/compiler/testData/codegen/box/when/kt55993.kt b/compiler/testData/codegen/box/when/kt55993.kt new file mode 100644 index 00000000000..7caa5cc98c9 --- /dev/null +++ b/compiler/testData/codegen/box/when/kt55993.kt @@ -0,0 +1,15 @@ +// CHECK_BYTECODE_TEXT + +fun test(boolean: Boolean) { + if (boolean) { // Breakpoint + throw IllegalArgumentException() + } + val x: Int +} + +fun box(): String { + test(false) + return "OK" +} + +// 1 LINENUMBER 7 L1\n +ICONST_0\n +ISTORE 1 diff --git a/compiler/testData/codegen/box/when/kt59346.kt b/compiler/testData/codegen/box/when/kt59346.kt new file mode 100644 index 00000000000..4b724b602dd --- /dev/null +++ b/compiler/testData/codegen/box/when/kt59346.kt @@ -0,0 +1,15 @@ +// CHECK_BYTECODE_TEXT + +fun test(boolean: Boolean) { + val x: Int // Breakpoint + if (boolean) { + throw IllegalArgumentException() + } +} + +fun box(): String { + test(false) + return "OK" +} + +// 1 LINENUMBER 4 diff --git a/compiler/testData/debug/stepping/variablesWithoutInitializer.kt b/compiler/testData/debug/stepping/variablesWithoutInitializer.kt index 474129ca397..09c9aedfc24 100644 --- a/compiler/testData/debug/stepping/variablesWithoutInitializer.kt +++ b/compiler/testData/debug/stepping/variablesWithoutInitializer.kt @@ -11,16 +11,15 @@ fun box() { } } -// The JVM IR backend does not generate line number information for the -// declaration of local variables without initializer. Stepping through -// those does not seem useful. This is consistent with javac behavior -// as well. The JVM backend does generate these line numbers. +// The JVM IR backend does generate line number information for the +// declaration of local variables without initializer. +// Stepping through those is useful for breakpoinnts. +// The JVM backend does generate these line numbers as well. -// EXPECTATIONS JVM +// EXPECTATIONS JVM JVM_IR // test.kt:4 box // test.kt:5 box // test.kt:6 box -// EXPECTATIONS JVM JVM_IR // test.kt:7 box // test.kt:8 box // test.kt:9 box 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 9d21cf31306..bf96f0396b8 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 @@ -49941,6 +49941,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() 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 a3e1e3b65f9..e04fd0bac9e 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 @@ -52977,6 +52977,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longCondition.kt") public void testLongCondition() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index d547f99319d..6ae2e52d1bf 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -52977,6 +52977,18 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longCondition.kt") public void testLongCondition() 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 fb7c02f8de3..38fbf3ed523 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -40717,6 +40717,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { runTest("compiler/testData/codegen/box/when/longInRange.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index f6db962c492..7b61aefa70a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -36483,6 +36483,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index ee9038d6ee0..6aa9b2e3f7c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -36909,6 +36909,18 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 6b135a0339b..d78068a50bb 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -36909,6 +36909,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 796b1a66bd5..522b9be1a13 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -36909,6 +36909,18 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java index 0f0034d6f8d..91d000b2f60 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java @@ -40587,6 +40587,18 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java index a0bf90f5944..e0ec5cd3764 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java @@ -41621,6 +41621,18 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 87ccbf157bc..5463a023a03 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -40071,6 +40071,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java index 4aa2c0b7b32..9df14afd138 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java @@ -40588,6 +40588,18 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @Test + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @Test + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @Test @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java index fb1f7d53ac9..db0500f1d87 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java @@ -32997,6 +32997,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/when/kt5448.kt"); } + @TestMetadata("kt55993.kt") + public void testKt55993() throws Exception { + runTest("compiler/testData/codegen/box/when/kt55993.kt"); + } + + @TestMetadata("kt59346.kt") + public void testKt59346() throws Exception { + runTest("compiler/testData/codegen/box/when/kt59346.kt"); + } + @TestMetadata("longInRange.kt") public void testLongInRange() throws Exception { runTest("compiler/testData/codegen/box/when/longInRange.kt");