diff --git a/compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt b/compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt new file mode 100644 index 00000000000..788602e4de7 --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt @@ -0,0 +1,54 @@ +// FILE: 1.kt + +package test + +interface Run { + fun run(): String +} + +inline fun i2(crossinline s: () -> String): Run { + return i1 { + object : Run { + override fun run(): String { + return s() + } + }.run() + } +} + +inline fun i1(crossinline s: () -> String): Run { + return object : Run { + override fun run(): String { + return s() + } + } +} + +// FILE: 2.kt + +import test.* + +inline fun i4(crossinline s: () -> String): Run { + return i3 { + object : Run { + override fun run(): String { + return s() + } + }.run() + } +} + +inline fun i3(crossinline s: () -> String): Run { + return i2 { + object : Run { + override fun run(): String { + return s() + } + }.run() + } +} + +fun box(): String { + val i4 = i4 { "OK" } + return i4.run() +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index 672e80e67b5..c41ef3aa61f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -115,6 +115,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo doTest(fileName); } + @TestMetadata("defineClass.kt") + public void testDefineClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); + doTest(fileName); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index 616d986275c..f459fed4f6c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -115,6 +115,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi doTest(fileName); } + @TestMetadata("defineClass.kt") + public void testDefineClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); + doTest(fileName); + } + @TestMetadata("kt6552.kt") public void testKt6552() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");