JS: a cross-module local declaration fake override test;
Also describe an alternative, more robust approach in a TODO comment
This commit is contained in:
+5
@@ -3880,6 +3880,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/inline/fakeOverrideInlining.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInliningCrossModule.kt")
|
||||
public void testFakeOverrideInliningCrossModule() throws Exception {
|
||||
runTest("js/js.translator/testData/box/inline/fakeOverrideInliningCrossModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("faultyRedundantCallElimination.kt")
|
||||
public void testFaultyRedundantCallElimination() throws Exception {
|
||||
runTest("js/js.translator/testData/box/inline/faultyRedundantCallElimination.kt");
|
||||
|
||||
+5
@@ -3880,6 +3880,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/inline/fakeOverrideInlining.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInliningCrossModule.kt")
|
||||
public void testFakeOverrideInliningCrossModule() throws Exception {
|
||||
runTest("js/js.translator/testData/box/inline/fakeOverrideInliningCrossModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("faultyRedundantCallElimination.kt")
|
||||
public void testFaultyRedundantCallElimination() throws Exception {
|
||||
runTest("js/js.translator/testData/box/inline/faultyRedundantCallElimination.kt");
|
||||
|
||||
@@ -218,6 +218,8 @@ class Merger(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO consider using metadata to determine current-module fake override statements
|
||||
// The approach could be similar to JsName.alias which is used to avoid re-importing current module declarations
|
||||
private fun JsStatement?.isFakeOverrideAssignment(): Boolean {
|
||||
fun JsExpression?.isMemberReference(): Boolean {
|
||||
val qualifier = (this as? JsNameRef)?.qualifier as? JsNameRef ?: return false
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1300
|
||||
// MODULE: libA
|
||||
// FILE: libA.kt
|
||||
inline fun foo() = (object : II {}).ok()
|
||||
|
||||
interface I {
|
||||
fun ok() = "OK"
|
||||
}
|
||||
|
||||
interface II: I
|
||||
|
||||
// MODULE: libB(libA)
|
||||
// FILE: libB.kt
|
||||
|
||||
inline fun bar() = foo()
|
||||
|
||||
// MODULE: main(libB)
|
||||
// FILE: main.kt
|
||||
fun box() = bar()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user