From 204cecd5d95eaa0d546e0ae0582424ac9af3ba80 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Mon, 18 Dec 2023 15:07:45 +0200 Subject: [PATCH] [box-tests] Added a reproducer for #KT-64139 --- ...LightTreeBlackBoxCodegenTestGenerated.java | 6 ++++ .../FirPsiBlackBoxCodegenTestGenerated.java | 6 ++++ .../box/coroutines/varSpilling/kt64139.kt | 33 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 ++++ .../IrBlackBoxCodegenTestGenerated.java | 6 ++++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 6 ++++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../fir/FirJsCodegenBoxTestGenerated.java | 6 ++++ .../fir/FirJsES6CodegenBoxTestGenerated.java | 6 ++++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 ++++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 6 ++++ .../FirNativeCodegenBoxTestGenerated.java | 6 ++++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 6 ++++ .../NativeCodegenBoxTestGenerated.java | 6 ++++ .../NativeCodegenBoxTestNoPLGenerated.java | 6 ++++ .../test/FirWasmCodegenBoxTestGenerated.java | 6 ++++ .../test/K1WasmCodegenBoxTestGenerated.java | 6 ++++ 17 files changed, 128 insertions(+) create mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt 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 9ed50ca5f0efd..e3bf8ff193f21 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 @@ -13690,6 +13690,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 433543ab931f0..dc2097dfd2a9d 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 @@ -13690,6 +13690,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() throws Exception { diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt b/compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt new file mode 100644 index 0000000000000..92cd8ed07d0a2 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt @@ -0,0 +1,33 @@ +// WITH_STDLIB +// WITH_COROUTINES +import helpers.* +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* + +suspend fun suspendHere(): Unit = suspendCoroutineUninterceptedOrReturn { x -> + x.resume(Unit) + COROUTINE_SUSPENDED +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +class Data(val x: Int) + +fun box(): String { + var result = "" + + builder { + var data = Data(0) + var done = false + do { + data = Data(1) + suspendHere() + done = true + } while (!done) + result = if (data.x == 1) "OK" else "fail" + } + + return result +} \ No newline at end of file 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 672fcc82e3a43..6b7423f4cb1c2 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 @@ -13402,6 +13402,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 6e4cc5bb07db5..b0f05963d9931 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 @@ -13690,6 +13690,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 9ca7696aec85a..63aa83e55a4aa 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 @@ -13690,6 +13690,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 6acebc95712cf..18a293d82195e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11120,6 +11120,11 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/lvtWithInlineOnly.kt"); 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 0247b08500e09..bad1666c5bb43 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 @@ -10018,6 +10018,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index 7db813b657f44..d0e3cd9ef5602 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -10018,6 +10018,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 fe28ce2d479f1..fa8b80a10a3f0 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 @@ -10018,6 +10018,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 bfc49ed20fb3f..14d64f344c944 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 @@ -10018,6 +10018,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 196e208fa008a..b259248496248 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 @@ -10980,6 +10980,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 3f5a515cfd382..caec403bfb406 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 @@ -11232,6 +11232,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 3749861652f5a..8ee3b75c9e5df 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 @@ -10855,6 +10855,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() 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 87a451e2a2921..8af25312706b2 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 @@ -10981,6 +10981,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 9c8008d13a078..d0b5c962ff003 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -9994,6 +9994,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 597200c5b0950..9c88795516284 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -9994,6 +9994,12 @@ public void testKt49834() throws Exception { runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt49834.kt"); } + @Test + @TestMetadata("kt64139.kt") + public void testKt64139() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/kt64139.kt"); + } + @Test @TestMetadata("lvtWithInlineOnly.kt") public void testLvtWithInlineOnly() throws Exception {