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 d41d7326100..992799ec4d7 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 @@ -356,6 +356,18 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 3ae3168747c..fce7b6bf85b 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 @@ -356,6 +356,18 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() 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 550cfe769a7..7b81c6b6ccd 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 @@ -356,6 +356,18 @@ public class FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends A runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() throws Exception { diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt new file mode 100644 index 00000000000..18a2cca343e --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt @@ -0,0 +1,20 @@ +// NO_CHECK_LAMBDA_INLINING +// FILE: 1.kt +inline fun mrun(block: () -> T) = block() + +// FILE: 2.kt +fun bar(o: String): String { + val callable = mrun { + fun localAnonymousFun(k: String): String { + val obj = object { + fun foo() = o + k + } + return obj.foo() + } + ::localAnonymousFun + } + + return callable("K") +} + +fun box() = bar("O") diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt new file mode 100644 index 00000000000..0fb81aa3735 --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt @@ -0,0 +1,34 @@ +// NO_CHECK_LAMBDA_INLINING +// IGNORE_BACKEND: JVM, WASM +// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_OLD_AGAINST_IR + +import kotlin.IllegalStateException + +// FILE: 1.kt +inline fun mrun(block: () -> T) = block() +inline fun mrunTwice(block: () -> T) : T { + val first = block() + val second = block() + if (first!!::class != second!!::class) + throw IllegalStateException("${first!!::class} != ${second!!::class}") + return first +} + +// FILE: 2.kt +fun bar(o: String): String { + val callable = mrun { + fun localAnonymousFun(k: String): String { + fun localAnonymousFunLevel2() = mrunTwice { + object { + fun foo() = o + k + } + } + return localAnonymousFunLevel2().foo() + } + ::localAnonymousFun + } + + return callable("K") +} + +fun box() = bar("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 69d349ff20c..6e14be80784 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 @@ -356,6 +356,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 92bdf029a15..a45295f80cd 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 @@ -356,6 +356,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 5f4a8d98057..b4fcd809502 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 @@ -356,6 +356,18 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 42c83f83d48..3fd0a7005f2 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 @@ -356,6 +356,18 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 b2d754d9143..f142cef7a79 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 @@ -356,6 +356,18 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 e6f5438d58f..4d49c295fe9 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 @@ -356,6 +356,18 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 50aaf008fa5..950b2ca4234 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 @@ -356,6 +356,18 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 32965c2e226..1e47f9edede 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 @@ -314,6 +314,18 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.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 ce8aebcad2f..3b0e7010767 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 @@ -314,6 +314,18 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java index e9eb19e7942..6a006e3eae2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxInlineWasmTestGenerated.java @@ -280,6 +280,16 @@ public class IrCodegenBoxInlineWasmTestGenerated extends AbstractIrCodegenBoxInl runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt"); + } + @TestMetadata("kt6007.kt") public void testKt6007() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6007.kt"); 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 5d1dec358f3..33820f915ac 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 @@ -40184,6 +40184,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/boxInline/anonymousObject/kt51950.kt"); } + @Test + @TestMetadata("kt52795.kt") + public void testKt52795() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795.kt"); + } + + @Test + @TestMetadata("kt52795_2.kt") + public void testKt52795_2() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt"); + } + @Test @TestMetadata("kt6007.kt") public void testKt6007() throws Exception {