diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt index 1438dc9681c..6b283045a8f 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/Psi2IrTranslator.kt @@ -73,8 +73,8 @@ class Psi2IrTranslator( val moduleGenerator = ModuleGenerator(context) val irModule = moduleGenerator.generateModuleFragmentWithoutDependencies(ktFiles) - expectDescriptorToSymbol?.let { referenceExpectsForUsedActuals(it, context.symbolTable, irModule) } irModule.patchDeclarationParents() + expectDescriptorToSymbol?.let { referenceExpectsForUsedActuals(it, context.symbolTable, irModule) } postprocess(context, irModule) // do not generate unbound symbols before postprocessing, // since plugins must work with non-lazy IR diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 58ea2ea8827..1cdc1d47b22 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -6796,6 +6796,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/regression/tmpInsidePrimaryConstructor.kt"); } + @TestMetadata("wrappers.kt") + public void testWrappers() throws Exception { + runTest("js/js.translator/testData/box/regression/wrappers.kt"); + } + @TestMetadata("js/js.translator/testData/box/regression/stdlibTestSnippets") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index 866dc42ab3b..0863dfbeec2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -6851,6 +6851,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/regression/tmpInsidePrimaryConstructor.kt"); } + @TestMetadata("wrappers.kt") + public void testWrappers() throws Exception { + runTest("js/js.translator/testData/box/regression/wrappers.kt"); + } + @TestMetadata("js/js.translator/testData/box/regression/stdlibTestSnippets") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.translator/testData/box/regression/wrappers.kt b/js/js.translator/testData/box/regression/wrappers.kt new file mode 100644 index 00000000000..a76fe586c49 --- /dev/null +++ b/js/js.translator/testData/box/regression/wrappers.kt @@ -0,0 +1,20 @@ +// EXPECTED_REACHABLE_NODES: 1309 +// KJS_WITH_FULL_RUNTIME + +// MODULE: lib +// FILE: lib.kt + +interface I +operator fun I.invoke(arg: String): String = + arg + +fun foo(context: I) = + emptyArray().forEach(context::invoke) + +// MODULE: main(lib) +// FILE: main.kt + +fun box(): String { + foo(object : I {}) + return "OK" +} \ No newline at end of file