From 18950feeff55c314d10a1be7ab3315f89ce698a3 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Mon, 27 Sep 2021 21:49:22 +0300 Subject: [PATCH] [JS IR] Add tests for KT-48941 --- .../test/es6/semantics/IrBoxJsES6TestGenerated.java | 10 ++++++++++ .../js/test/ir/semantics/IrBoxJsTestGenerated.java | 10 ++++++++++ .../kotlin/js/test/semantics/BoxJsTestGenerated.java | 10 ++++++++++ js/js.translator/testData/box/jsCode/literalInVal.kt | 11 +++++++++++ .../testData/box/jsCode/literalInValField.kt | 11 +++++++++++ 5 files changed, 52 insertions(+) create mode 100644 js/js.translator/testData/box/jsCode/literalInVal.kt create mode 100644 js/js.translator/testData/box/jsCode/literalInValField.kt diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java index abaaef0a143..aad16b3ef84 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrBoxJsES6TestGenerated.java @@ -5165,6 +5165,16 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { runTest("js/js.translator/testData/box/jsCode/literal.kt"); } + @TestMetadata("literalInVal.kt") + public void testLiteralInVal() throws Exception { + runTest("js/js.translator/testData/box/jsCode/literalInVal.kt"); + } + + @TestMetadata("literalInValField.kt") + public void testLiteralInValField() throws Exception { + runTest("js/js.translator/testData/box/jsCode/literalInValField.kt"); + } + @TestMetadata("numberLiteralOverflow.kt") public void testNumberLiteralOverflow() throws Exception { runTest("js/js.translator/testData/box/jsCode/numberLiteralOverflow.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 38a61db9236..a9e810ed8f9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -5165,6 +5165,16 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { runTest("js/js.translator/testData/box/jsCode/literal.kt"); } + @TestMetadata("literalInVal.kt") + public void testLiteralInVal() throws Exception { + runTest("js/js.translator/testData/box/jsCode/literalInVal.kt"); + } + + @TestMetadata("literalInValField.kt") + public void testLiteralInValField() throws Exception { + runTest("js/js.translator/testData/box/jsCode/literalInValField.kt"); + } + @TestMetadata("numberLiteralOverflow.kt") public void testNumberLiteralOverflow() throws Exception { runTest("js/js.translator/testData/box/jsCode/numberLiteralOverflow.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index e29743ddeec..fe2c33daa6e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -5175,6 +5175,16 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest { runTest("js/js.translator/testData/box/jsCode/literal.kt"); } + @TestMetadata("literalInVal.kt") + public void testLiteralInVal() throws Exception { + runTest("js/js.translator/testData/box/jsCode/literalInVal.kt"); + } + + @TestMetadata("literalInValField.kt") + public void testLiteralInValField() throws Exception { + runTest("js/js.translator/testData/box/jsCode/literalInValField.kt"); + } + @TestMetadata("numberLiteralOverflow.kt") public void testNumberLiteralOverflow() throws Exception { runTest("js/js.translator/testData/box/jsCode/numberLiteralOverflow.kt"); diff --git a/js/js.translator/testData/box/jsCode/literalInVal.kt b/js/js.translator/testData/box/jsCode/literalInVal.kt new file mode 100644 index 00000000000..850099e8c8d --- /dev/null +++ b/js/js.translator/testData/box/jsCode/literalInVal.kt @@ -0,0 +1,11 @@ +fun foo(): String { + val q1 = "O" + val q2 = "K" + val qq = q1 + q2 + val b = js("\"$qq\"") + return b +} + + + +fun box() = foo() \ No newline at end of file diff --git a/js/js.translator/testData/box/jsCode/literalInValField.kt b/js/js.translator/testData/box/jsCode/literalInValField.kt new file mode 100644 index 00000000000..b61783258cd --- /dev/null +++ b/js/js.translator/testData/box/jsCode/literalInValField.kt @@ -0,0 +1,11 @@ +val p1 = "O" +val p2 = "K" +val pp = p1 + p2 + +fun bar(): String { + val v = pp + val b = js("\"$v\"") + return b +} + +fun box(): String = bar() \ No newline at end of file