[JS IR] Use a copy of an original inline function for inlining

If inline function A calls another inline function B,
 we must use the original version of inline function A for inlining,
 which doesn’t have inlined function B. Because during the inlining
 process, we remap all occurrences of inline function A
 to a temporary copy of function A, and if the function B
 somehow uses function A (e.g. callable reference),
 the built IR will have a reference to the temporary function,
 not the original one. All these things lead to broken cross-module references.

 This patch saves the original versions of all inline functions
 before inlining and provides them during the inline process.

^KT-55930 Fixed
This commit is contained in:
Alexander Korepanov
2023-01-13 16:07:00 +01:00
committed by Space Team
parent 82d934d873
commit a5c8e30bb1
9 changed files with 110 additions and 7 deletions
@@ -5162,6 +5162,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/inline/privateProperty.kt");
}
@Test
@TestMetadata("recursiveDependency.kt")
public void testRecursiveDependency() throws Exception {
runTest("js/js.translator/testData/box/inline/recursiveDependency.kt");
}
@Test
@TestMetadata("rootConstructor.kt")
public void testRootConstructor() throws Exception {
@@ -5784,6 +5784,12 @@ public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest {
runTest("js/js.translator/testData/box/inline/privateProperty.kt");
}
@Test
@TestMetadata("recursiveDependency.kt")
public void testRecursiveDependency() throws Exception {
runTest("js/js.translator/testData/box/inline/recursiveDependency.kt");
}
@Test
@TestMetadata("rootConstructor.kt")
public void testRootConstructor() throws Exception {
@@ -5784,6 +5784,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/inline/privateProperty.kt");
}
@Test
@TestMetadata("recursiveDependency.kt")
public void testRecursiveDependency() throws Exception {
runTest("js/js.translator/testData/box/inline/recursiveDependency.kt");
}
@Test
@TestMetadata("rootConstructor.kt")
public void testRootConstructor() throws Exception {