From 2612609664e453813831ca3d8ecae2c1583c1bec Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Wed, 2 Sep 2020 13:46:15 +0300 Subject: [PATCH] [JS] Add test for KT-39378 --- .../semantics/IrBoxJsES6TestGenerated.java | 5 +++ .../ir/semantics/IrBoxJsTestGenerated.java | 5 +++ .../js/test/semantics/BoxJsTestGenerated.java | 5 +++ .../testData/box/jsModule/kt39378.js | 5 +++ .../testData/box/jsModule/kt39378.kt | 34 +++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 js/js.translator/testData/box/jsModule/kt39378.js create mode 100644 js/js.translator/testData/box/jsModule/kt39378.kt diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index 62ef9dba945..40ae1fc109f 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -5237,6 +5237,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/jsModule/interfaces.kt"); } + @TestMetadata("kt39378.kt") + public void testKt39378() throws Exception { + runTest("js/js.translator/testData/box/jsModule/kt39378.kt"); + } + @TestMetadata("topLevelVarargFun.kt") public void testTopLevelVarargFun() throws Exception { runTest("js/js.translator/testData/box/jsModule/topLevelVarargFun.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 7b72d121ae4..e80dfd5f528 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 @@ -5237,6 +5237,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/jsModule/interfaces.kt"); } + @TestMetadata("kt39378.kt") + public void testKt39378() throws Exception { + runTest("js/js.translator/testData/box/jsModule/kt39378.kt"); + } + @TestMetadata("topLevelVarargFun.kt") public void testTopLevelVarargFun() throws Exception { runTest("js/js.translator/testData/box/jsModule/topLevelVarargFun.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 88db12468f9..555c09afe59 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 @@ -5252,6 +5252,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/jsModule/interfaces.kt"); } + @TestMetadata("kt39378.kt") + public void testKt39378() throws Exception { + runTest("js/js.translator/testData/box/jsModule/kt39378.kt"); + } + @TestMetadata("topLevelVarargFun.kt") public void testTopLevelVarargFun() throws Exception { runTest("js/js.translator/testData/box/jsModule/topLevelVarargFun.kt"); diff --git a/js/js.translator/testData/box/jsModule/kt39378.js b/js/js.translator/testData/box/jsModule/kt39378.js new file mode 100644 index 00000000000..6f1a6b6bba7 --- /dev/null +++ b/js/js.translator/testData/box/jsModule/kt39378.js @@ -0,0 +1,5 @@ +function ee() { + return { + ss: ['O' , 'K'] + } +} diff --git a/js/js.translator/testData/box/jsModule/kt39378.kt b/js/js.translator/testData/box/jsModule/kt39378.kt new file mode 100644 index 00000000000..0bdaaebcf17 --- /dev/null +++ b/js/js.translator/testData/box/jsModule/kt39378.kt @@ -0,0 +1,34 @@ +// EXPECTED_REACHABLE_NODES: 1238 + +// MODULE: lib +// FILE: l.kt + +package l + +external interface E { + var ss: Array // Effectively external property. +} + +external fun ee(): E + +fun foo(): String { + + val e = ee() + + var result = "" + + for (s in e.ss) { + result += s + } + + return result +} + +// MODULE: main(lib) +// FILE: m.kt + +import l.* + +fun box(): String { + return foo() +} \ No newline at end of file