From a1f0c6208c36121a84c85fb44605f4b565edbf2a Mon Sep 17 00:00:00 2001 From: pyos Date: Thu, 28 Apr 2022 16:52:54 +0200 Subject: [PATCH] Add a test from KT-51950 --- ...FirBlackBoxInlineCodegenTestGenerated.java | 6 +++++ ...reeBlackBoxInlineCodegenTestGenerated.java | 6 +++++ .../boxInline/anonymousObject/kt51950.kt | 24 +++++++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 6 +++++ ...otlinAgainstInlineKotlinTestGenerated.java | 6 +++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 6 +++++ ...otlinAgainstInlineKotlinTestGenerated.java | 6 +++++ ...otlinAgainstInlineKotlinTestGenerated.java | 6 +++++ ...JvmIrAgainstOldBoxInlineTestGenerated.java | 6 +++++ ...JvmOldAgainstIrBoxInlineTestGenerated.java | 6 +++++ .../js/test/JsCodegenInlineTestGenerated.java | 6 +++++ .../ir/IrJsCodegenInlineTestGenerated.java | 6 +++++ .../NativeCodegenBoxTestGenerated.java | 6 +++++ 13 files changed, 96 insertions(+) create mode 100644 compiler/testData/codegen/boxInline/anonymousObject/kt51950.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 ae26ed3c336..3cb5aa9d838 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 @@ -338,6 +338,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java index d66b7288fc3..7d5ef78bca6 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java @@ -338,6 +338,12 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() throws Exception { diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt new file mode 100644 index 00000000000..190dc1dac16 --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt @@ -0,0 +1,24 @@ +// FILE: 1.kt +interface Service { + fun send(message: String): String +} + +inline fun Service.decorate(crossinline decorate: (Service) -> Service): Service = + object : Service by decorate(this) {} + +inline fun Service.transformMessage(crossinline transform: (String) -> String) = + decorate { service -> + object : Service { + override fun send(message: String): String = + service.send(transform(message)) + } + } + +// FILE: 2.kt +fun Service.append(suffix: String): Service = + transformMessage { it + suffix } + +fun box(): String = + object : Service { + override fun send(message: String): String = message + }.append("K").send("O") 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 2c627d69998..1bd2c44a3e8 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 @@ -338,6 +338,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 632b84757af..299c6ac049f 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 @@ -338,6 +338,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 4d610ded453..521680e97d9 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 @@ -338,6 +338,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 904c5a7e89f..f3926275054 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 @@ -338,6 +338,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 3179b5e6964..bc4250a6257 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 @@ -338,6 +338,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 a2f2c5c0a95..fa890ed8ede 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 @@ -338,6 +338,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 f655f68cdae..48a54397bcb 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 @@ -338,6 +338,12 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 fb9b70108f7..1bbfda93cca 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 @@ -296,6 +296,12 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 957b8e1161b..5ddf65e0eee 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 @@ -296,6 +296,12 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 248f9aafebc..39b1d580b0d 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 @@ -39264,6 +39264,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/boxInline/anonymousObject/kt42815_delegated.kt"); } + @Test + @TestMetadata("kt51950.kt") + public void testKt51950() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() throws Exception {