diff --git a/compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt b/compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt new file mode 100644 index 00000000000..f77cb93d15f --- /dev/null +++ b/compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt @@ -0,0 +1,31 @@ +// IGNORE_BACKEND: JVM +// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_IR + +// FILE: 1.kt + +package test + +interface Foo { + fun compute(): Int +} + +inline fun foo(x: Int, block: (Int) -> Foo) = block(x) + +// FILE: 2.kt + +import test.* + +fun bar(): Int { + return foo(21) { x -> + val o = object : Foo { + override fun compute(): Int { + return call { x * 2 } + } + + private fun call(f: () -> Int) = f() + } + o + }.compute() +} + +fun box() = if (bar() == 42) "OK" else "fail" \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index ea48790479f..81008c221c7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -121,6 +121,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index f87c480e6d6..071209cfb54 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -121,6 +121,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index 38fec729dc8..22ab309258e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -121,6 +121,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 536225deb89..29e447c6a16 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -121,6 +121,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java index 9549f29d35f..148b0f04e55 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java @@ -121,6 +121,11 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index d998c39fd6d..f23eba0916e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -121,6 +121,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index 539a2c51380..46524851d82 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -121,6 +121,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt"); } + @TestMetadata("functionExpression.kt") + public void testFunctionExpression() throws Exception { + runTest("compiler/testData/codegen/boxInline/anonymousObject/functionExpression.kt"); + } + @TestMetadata("inlineCallInsideInlineLambda.kt") public void testInlineCallInsideInlineLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/anonymousObject/inlineCallInsideInlineLambda.kt");