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 4c7cca2d970..71e8514458a 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 @@ -5940,6 +5940,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/nameClashes/constructorLocalVar.kt"); } + @TestMetadata("constructorsCrossFile.kt") + public void testConstructorsCrossFile() throws Exception { + runTest("js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt"); + } + @TestMetadata("differenceInCapitalization.kt") public void testDifferenceInCapitalization() throws Exception { runTest("js/js.translator/testData/box/nameClashes/differenceInCapitalization.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrBoxJsTestGenerated.java index f403058e311..c881615ce19 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrBoxJsTestGenerated.java @@ -5940,6 +5940,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/nameClashes/constructorLocalVar.kt"); } + @TestMetadata("constructorsCrossFile.kt") + public void testConstructorsCrossFile() throws Exception { + runTest("js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt"); + } + @TestMetadata("differenceInCapitalization.kt") public void testDifferenceInCapitalization() throws Exception { runTest("js/js.translator/testData/box/nameClashes/differenceInCapitalization.kt"); diff --git a/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt b/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt new file mode 100644 index 00000000000..ff48a4bf714 --- /dev/null +++ b/js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt @@ -0,0 +1,29 @@ +// EXPECTED_REACHABLE_NODES: 1276 +// FILE: lib.kt + +// Force contructor renaming +val dummy = run { + if (false) { + js("A") + js("A_init") + } + null +} + +class A(val s: String) { + constructor(c: Char) : this("$c") +} + +inline fun ok() = A("O").s + A('K').s + +// FILE: main.kt + + +// TODO add directives for primary contructor invocations +// CHECK_CALLED_IN_SCOPE: function=A_init_0 scope=box +// CHECK_NOT_CALLED_IN_SCOPE: function=A_init scope=box +fun box(): String { + if (A("O").s + A('K').s != "OK") return "fail" + + return ok() +}