From f5a431490c2bf33a9785de6c7cb2c543599b71bc Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Mon, 30 Jan 2017 20:02:59 +0300 Subject: [PATCH] JS: verified that String concatenation with large Long's is fixed (KT-8666) --- .../testData/codegen/box/intrinsics/kt8666.kt | 18 ++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 6 ++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 ++++++ .../LightAnalysisModeCodegenTestGenerated.java | 6 ++++++ .../semantics/JsCodegenBoxTestGenerated.java | 6 ++++++ 5 files changed, 42 insertions(+) create mode 100644 compiler/testData/codegen/box/intrinsics/kt8666.kt diff --git a/compiler/testData/codegen/box/intrinsics/kt8666.kt b/compiler/testData/codegen/box/intrinsics/kt8666.kt new file mode 100644 index 00000000000..835340e3afe --- /dev/null +++ b/compiler/testData/codegen/box/intrinsics/kt8666.kt @@ -0,0 +1,18 @@ +val MAX_LONG = "9223372036854775807" +val PREFIX = "max = " + +fun box(): String { + if (MAX_LONG != "${Long.MAX_VALUE}") return "fail template" + if (MAX_LONG != "" + Long.MAX_VALUE) return "fail \"\" +" + if (MAX_LONG != "".plus(Long.MAX_VALUE)) return "fail \"\".plus" + if (MAX_LONG != (String::plus)("", Long.MAX_VALUE)) return "fail String::plus" + if (MAX_LONG != (""::plus)(Long.MAX_VALUE)) return "fail \"\"::plus" + + if (PREFIX + MAX_LONG != "max = ${Long.MAX_VALUE}") return "fail template with prefix" + if (PREFIX + MAX_LONG != PREFIX + Long.MAX_VALUE) return "fail \"$PREFIX\" +" + if (PREFIX + MAX_LONG != PREFIX.plus(Long.MAX_VALUE)) return "fail \"$PREFIX\".plus" + if (PREFIX + MAX_LONG != (String::plus)(PREFIX, Long.MAX_VALUE)) return "fail String::plus($PREFIX, ...)" + if (PREFIX + MAX_LONG != (PREFIX::plus)(Long.MAX_VALUE)) return "fail \"$PREFIX\"::plus" + + return "OK" +} diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 3d08a308905..5e9a4d68ac0 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -8939,6 +8939,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("kt8666.kt") + public void testKt8666() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/kt8666.kt"); + doTest(fileName); + } + @TestMetadata("longRangeWithExplicitDot.kt") public void testLongRangeWithExplicitDot() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/longRangeWithExplicitDot.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 9ae0e69d857..239e4cbfea6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -8939,6 +8939,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("kt8666.kt") + public void testKt8666() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/kt8666.kt"); + doTest(fileName); + } + @TestMetadata("longRangeWithExplicitDot.kt") public void testLongRangeWithExplicitDot() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/longRangeWithExplicitDot.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java index 4f6688180c1..46ca3060f41 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java @@ -8939,6 +8939,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis doTest(fileName); } + @TestMetadata("kt8666.kt") + public void testKt8666() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/kt8666.kt"); + doTest(fileName); + } + @TestMetadata("longRangeWithExplicitDot.kt") public void testLongRangeWithExplicitDot() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/longRangeWithExplicitDot.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 0f94af6c88d..0aa6faf6ce0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10002,6 +10002,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); } + @TestMetadata("kt8666.kt") + public void testKt8666() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/kt8666.kt"); + doTest(fileName); + } + @TestMetadata("longRangeWithExplicitDot.kt") public void testLongRangeWithExplicitDot() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/longRangeWithExplicitDot.kt");