[PSI2IR] Patch parents before referenceExpectsForUsedActuals

There were some ADAPTER_FOR_CALLABLE_REFERENCE functions with
uninitialized parents at this point.
This commit is contained in:
Svyatoslav Kuzmich
2020-02-25 19:17:40 +03:00
parent 1e02fa3db9
commit dff7d7b7b9
4 changed files with 31 additions and 1 deletions
@@ -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
@@ -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)
@@ -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)
+20
View File
@@ -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<String>().forEach(context::invoke)
// MODULE: main(lib)
// FILE: main.kt
fun box(): String {
foo(object : I {})
return "OK"
}