JS: don't remove imports only used for fake overrides (KT-31007 fixed)
This commit is contained in:
@@ -18,6 +18,6 @@ package org.jetbrains.kotlin.js.backend.ast
|
||||
|
||||
class JsClassModel(val name: JsName, val superName: JsName?) {
|
||||
val interfaces: MutableSet<JsName> = mutableSetOf()
|
||||
val preDeclarationBlock = JsGlobalBlock()
|
||||
val preDeclarationBlock = JsGlobalBlock() // TODO only used in IR backend => hide from current backend
|
||||
val postDeclarationBlock = JsGlobalBlock()
|
||||
}
|
||||
|
||||
@@ -140,6 +140,9 @@ class ImportIntoFragmentInliningScope private constructor(
|
||||
get() = JsBlock(
|
||||
JsBlock(fragment.inlinedLocalDeclarations.values.toList()),
|
||||
fragment.declarationBlock,
|
||||
JsBlock(fragment.classes.values.flatMap {
|
||||
listOf(it.preDeclarationBlock, it.postDeclarationBlock)
|
||||
}),
|
||||
fragment.exportBlock,
|
||||
JsExpressionStatement(JsFunction(JsDynamicScope, fragment.initializerBlock, ""))
|
||||
).also { block ->
|
||||
|
||||
+5
@@ -5316,6 +5316,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/multiModule/moduleAndVariableNameClash.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateInterfaceMethodInheritance.kt")
|
||||
public void testPrivateInterfaceMethodInheritance() throws Exception {
|
||||
runTest("js/js.translator/testData/box/multiModule/privateInterfaceMethodInheritance.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateInterfaceNameClash.kt")
|
||||
public void testPrivateInterfaceNameClash() throws Exception {
|
||||
runTest("js/js.translator/testData/box/multiModule/privateInterfaceNameClash.kt");
|
||||
|
||||
+5
@@ -5321,6 +5321,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/multiModule/moduleAndVariableNameClash.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateInterfaceMethodInheritance.kt")
|
||||
public void testPrivateInterfaceMethodInheritance() throws Exception {
|
||||
runTest("js/js.translator/testData/box/multiModule/privateInterfaceMethodInheritance.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateInterfaceNameClash.kt")
|
||||
public void testPrivateInterfaceNameClash() throws Exception {
|
||||
runTest("js/js.translator/testData/box/multiModule/privateInterfaceNameClash.kt");
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1280
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
package lib
|
||||
|
||||
interface A {
|
||||
private fun foo() = "OK"
|
||||
|
||||
fun bar() = foo()
|
||||
}
|
||||
|
||||
open class AProxy: A
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
package main
|
||||
|
||||
// KT-31007
|
||||
import lib.AProxy
|
||||
|
||||
// Important bit: don't inherit A directly
|
||||
class B : AProxy()
|
||||
|
||||
fun box(): String = B().bar()
|
||||
Reference in New Issue
Block a user