From 5d3b61364ac5c16de999b03627047e4c004014c3 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Fri, 17 Feb 2023 09:00:59 +0200 Subject: [PATCH] Added a test for KT-56500 --- .../FirBlackBoxInlineCodegenTestGenerated.java | 6 ++++++ ...irPsiBlackBoxInlineCodegenTestGenerated.java | 6 ++++++ ...eKotlinAgainstInlineKotlinTestGenerated.java | 6 ++++++ ...eKotlinAgainstInlineKotlinTestGenerated.java | 6 ++++++ .../codegen/boxInline/capture/kt56500.kt | 17 +++++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 6 ++++++ ...eKotlinAgainstInlineKotlinTestGenerated.java | 6 ++++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 6 ++++++ ...eKotlinAgainstInlineKotlinTestGenerated.java | 6 ++++++ ...eKotlinAgainstInlineKotlinTestGenerated.java | 6 ++++++ .../JvmIrAgainstOldBoxInlineTestGenerated.java | 6 ++++++ .../JvmOldAgainstIrBoxInlineTestGenerated.java | 6 ++++++ .../js/test/JsCodegenInlineTestGenerated.java | 6 ++++++ .../fir/FirJsCodegenInlineTestGenerated.java | 6 ++++++ .../test/ir/IrJsCodegenInlineTestGenerated.java | 6 ++++++ .../ir/IrJsES6CodegenInlineTestGenerated.java | 6 ++++++ .../K2NativeCodegenBoxTestGenerated.java | 6 ++++++ .../NativeCodegenBoxTestGenerated.java | 6 ++++++ .../IrCodegenBoxInlineWasmTestGenerated.java | 5 +++++ 19 files changed, 124 insertions(+) create mode 100644 compiler/testData/codegen/boxInline/capture/kt56500.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java index 009c201b0f0..6e0237ff94d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java @@ -1436,6 +1436,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java index d0956f33f12..eb9b60df98d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java @@ -1436,6 +1436,12 @@ public class FirPsiBlackBoxInlineCodegenTestGenerated extends AbstractFirPsiBlac runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index a40414c4cb9..567db59188b 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1436,6 +1436,12 @@ public class FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated extend runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index 768bf9b8492..ac29e8443ee 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1436,6 +1436,12 @@ public class FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends A runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/testData/codegen/boxInline/capture/kt56500.kt b/compiler/testData/codegen/boxInline/capture/kt56500.kt new file mode 100644 index 00000000000..879a2940ba9 --- /dev/null +++ b/compiler/testData/codegen/boxInline/capture/kt56500.kt @@ -0,0 +1,17 @@ +// NO_CHECK_LAMBDA_INLINING +// FILE: 1.kt +class Box(val value: T) { + inline fun run(block: (T) -> Unit) { + block(value) + } +} + +// FILE: 2.kt +fun box(): String { + var result: String = "fail" + Box("OK").run { outer -> + val block = { result = outer } + block() + } + return result +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java index 24795dd97ee..4bfe28ee9e1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -1412,6 +1412,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index a3ceee1a689..d3a71ca53b4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1412,6 +1412,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java index dfc86cc010a..b1fef848a23 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java @@ -1436,6 +1436,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 1ec02ea0d6a..5ce58059630 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1436,6 +1436,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index 4f310d8a921..3cbcffdc8f8 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1436,6 +1436,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java index aa6bd8699b6..23d6cb3a588 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -1436,6 +1436,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java index d88b096457a..93787080cb6 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java @@ -1412,6 +1412,12 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenInlineTestGenerated.java index 2fdf96f1f58..3e975833ed5 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenInlineTestGenerated.java @@ -1208,6 +1208,12 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenInlineTestGenerated.java index 07e51344080..b584d23340a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenInlineTestGenerated.java @@ -1208,6 +1208,12 @@ public class FirJsCodegenInlineTestGenerated extends AbstractFirJsCodegenInlineT runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenInlineTestGenerated.java index d43e1b53dec..ccd14df99e9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenInlineTestGenerated.java @@ -1208,6 +1208,12 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenInlineTestGenerated.java index 5267fb5a2fc..9cca39a56b1 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenInlineTestGenerated.java @@ -1208,6 +1208,12 @@ public class IrJsES6CodegenInlineTestGenerated extends AbstractIrJsES6CodegenInl runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java index 7157bef3bb0..51d9d06f1f1 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java @@ -42221,6 +42221,12 @@ public class K2NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTes runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() 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 c4043ec546f..da6a10b22d7 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 @@ -41696,6 +41696,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @Test + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @Test @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java index 239911f1f5b..509418a2522 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxInlineWasmTestGenerated.java @@ -1095,6 +1095,11 @@ public class IrCodegenBoxInlineWasmTestGenerated extends AbstractIrCodegenBoxInl runTest("compiler/testData/codegen/boxInline/capture/kt48230_2.kt"); } + @TestMetadata("kt56500.kt") + public void testKt56500() throws Exception { + runTest("compiler/testData/codegen/boxInline/capture/kt56500.kt"); + } + @TestMetadata("simpleCapturingInClass.kt") public void testSimpleCapturingInClass() throws Exception { runTest("compiler/testData/codegen/boxInline/capture/simpleCapturingInClass.kt");