From 90504c797af0565c89d30b3a410e96a2dd16f249 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Fri, 23 Aug 2019 15:28:55 +0300 Subject: [PATCH] [IR SERIALIZATION] Add tests about klib linkage --- .../ir/semantics/IrBoxJsTestGenerated.java | 10 +++++ .../js/test/semantics/BoxJsTestGenerated.java | 10 +++++ .../box/multiModule/clashedDeclLinkage.kt | 41 +++++++++++++++++++ .../clashedInternalDeclarations.kt | 41 +++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 js/js.translator/testData/box/multiModule/clashedDeclLinkage.kt create mode 100644 js/js.translator/testData/box/multiModule/clashedInternalDeclarations.kt diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 1f24fbc9543..8932a5d2fcb 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -5339,6 +5339,16 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModule"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true); } + @TestMetadata("clashedDeclLinkage.kt") + public void testClashedDeclLinkage() throws Exception { + runTest("js/js.translator/testData/box/multiModule/clashedDeclLinkage.kt"); + } + + @TestMetadata("clashedInternalDeclarations.kt") + public void testClashedInternalDeclarations() throws Exception { + runTest("js/js.translator/testData/box/multiModule/clashedInternalDeclarations.kt"); + } + @TestMetadata("interfaceMethodWithDefaultParameter.kt") public void testInterfaceMethodWithDefaultParameter() throws Exception { runTest("js/js.translator/testData/box/multiModule/interfaceMethodWithDefaultParameter.kt"); 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 cae4a2c4a6c..ff8a1459721 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 @@ -5354,6 +5354,16 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/multiModule"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true); } + @TestMetadata("clashedDeclLinkage.kt") + public void testClashedDeclLinkage() throws Exception { + runTest("js/js.translator/testData/box/multiModule/clashedDeclLinkage.kt"); + } + + @TestMetadata("clashedInternalDeclarations.kt") + public void testClashedInternalDeclarations() throws Exception { + runTest("js/js.translator/testData/box/multiModule/clashedInternalDeclarations.kt"); + } + @TestMetadata("interfaceMethodWithDefaultParameter.kt") public void testInterfaceMethodWithDefaultParameter() throws Exception { runTest("js/js.translator/testData/box/multiModule/interfaceMethodWithDefaultParameter.kt"); diff --git a/js/js.translator/testData/box/multiModule/clashedDeclLinkage.kt b/js/js.translator/testData/box/multiModule/clashedDeclLinkage.kt new file mode 100644 index 00000000000..bc37ad7d2dc --- /dev/null +++ b/js/js.translator/testData/box/multiModule/clashedDeclLinkage.kt @@ -0,0 +1,41 @@ +// KJS_WITH_FULL_RUNTIME + +// MODULE: AT +// FILE: at.kt +package foo + +fun ooo(): String = "O" +fun kkk(): String = "Fail AT" + +// MODULE: A(AT) +// FILE: a.kt +package bar + +import foo.* + +fun o(): String = ooo() + +// MODULE: BT +// FILE: bt.kt +package foo + +fun ooo(): String = "Fail BT" +fun kkk(): String = "K" + +// MODULE: B(BT) +// FILE: b.kt +package bar + +import foo.* + +fun k(): String = kkk() + +// MODULE: main(A, B) +// FILE: main.kt +package main + +import bar.* + +fun box(): String { + return o() + k() +} \ No newline at end of file diff --git a/js/js.translator/testData/box/multiModule/clashedInternalDeclarations.kt b/js/js.translator/testData/box/multiModule/clashedInternalDeclarations.kt new file mode 100644 index 00000000000..02157e973ec --- /dev/null +++ b/js/js.translator/testData/box/multiModule/clashedInternalDeclarations.kt @@ -0,0 +1,41 @@ +// KJS_WITH_FULL_RUNTIME + +// MODULE: AT +// FILE: at.kt +package foo + +internal fun qqq() = "Fail AT" + +// MODULE: A(AT) +// FILE: a.kt +package foo + +internal fun qqq() = "O" + +fun o(): String = qqq() + +// MODULE: BT +// FILE: bt.kt +package foo + +internal fun qqq() = "K" + +fun ik() = qqq() + +// MODULE: B(BT) +// FILE: b.kt +package foo + +internal fun qqq() = "Fail B" + +fun k(): String = ik() + +// MODULE: main(A, B) +// FILE: main.kt +package main + +import foo.* + +fun box(): String { + return o() + k() +} \ No newline at end of file