From a093efde11453bf8d0b4f9e1d26239047dbdeb35 Mon Sep 17 00:00:00 2001 From: Mark Punzalan Date: Wed, 7 Oct 2020 23:40:18 +0000 Subject: [PATCH] Add blackbox test for KT-42533. --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++++ .../codegen/box/ranges/forInUntil/kt42533.kt | 23 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++++ .../LightAnalysisModeTestGenerated.java | 5 ++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++++ .../IrJsCodegenBoxTestGenerated.java | 15 ++++-------- .../semantics/JsCodegenBoxTestGenerated.java | 5 ++++ 8 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index d33400129bc..b46b0c0f30b 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -22466,6 +22466,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testForIntInIntUntilSmartcastInt() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt"); } + + @TestMetadata("kt42533.kt") + public void testKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forWithPossibleOverflow") diff --git a/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt b/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt new file mode 100644 index 00000000000..dd0029787d2 --- /dev/null +++ b/compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt @@ -0,0 +1,23 @@ +// IGNORE_BACKEND: JVM +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +fun box(): String { + // These should all be empty progressions + for (i in (Int.MAX_VALUE - 2) until Int.MIN_VALUE) { return "Fail: Int" } + for (i in ((Int.MAX_VALUE - 2) until Int.MIN_VALUE).reversed()) { return "Fail: Int reversed" } + + for (i in (Long.MAX_VALUE - 2) until Long.MIN_VALUE) { return "Fail: Long" } + for (i in ((Long.MAX_VALUE - 2) until Long.MIN_VALUE).reversed()) { return "Fail: Long reversed" } + + for (i in (Char.MAX_VALUE - 2) until Char.MIN_VALUE) { return "Fail: Char" } + for (i in ((Char.MAX_VALUE - 2) until Char.MIN_VALUE).reversed()) { return "Fail: Char reversed" } + + for (i in (UInt.MAX_VALUE - 2u) until UInt.MIN_VALUE) { return "Fail: UInt" } + for (i in ((UInt.MAX_VALUE - 2u) until UInt.MIN_VALUE).reversed()) { return "Fail: UInt reversed" } + + for (i in (ULong.MAX_VALUE - 2u) until ULong.MIN_VALUE) { return "Fail: ULong" } + for (i in ((ULong.MAX_VALUE - 2u) until ULong.MIN_VALUE).reversed()) { return "Fail: ULong reversed" } + + return "OK" +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index adc9e825912..d750ea5b7b0 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -24232,6 +24232,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testForIntInIntUntilSmartcastInt() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt"); } + + @TestMetadata("kt42533.kt") + public void testKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forWithPossibleOverflow") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a4e18f681b5..36c8b39a798 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -24155,6 +24155,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class ForInUntil extends AbstractLightAnalysisModeTest { + @TestMetadata("kt42533.kt") + public void ignoreKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } + private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 9e6a69600ec..b08d61b0a2e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -22466,6 +22466,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testForIntInIntUntilSmartcastInt() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt"); } + + @TestMetadata("kt42533.kt") + public void testKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forWithPossibleOverflow") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 9c549f7f5e2..45a4a289689 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -18807,6 +18807,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testForIntInIntUntilSmartcastInt() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt"); } + + @TestMetadata("kt42533.kt") + public void testKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forWithPossibleOverflow") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index bd72fe2dbaa..8fdcfa83740 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -16913,16 +16913,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectChar.kt"); } - @TestMetadata("primitiveEqObjectInt.kt") - public void testPrimitiveEqObjectInt() throws Exception { - runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectInt.kt"); - } - - @TestMetadata("primitiveEqObjectLong.kt") - public void testPrimitiveEqObjectLong() throws Exception { - runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectLong.kt"); - } - @TestMetadata("primitiveEqObjectShort.kt") public void testPrimitiveEqObjectShort() throws Exception { runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/generated/primitiveEqObjectShort.kt"); @@ -18807,6 +18797,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testForIntInIntUntilSmartcastInt() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt"); } + + @TestMetadata("kt42533.kt") + public void testKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forWithPossibleOverflow") 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 ed4cb68a447..7113c5d0e33 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 @@ -18912,6 +18912,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testForIntInIntUntilSmartcastInt() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInUntil/forIntInIntUntilSmartcastInt.kt"); } + + @TestMetadata("kt42533.kt") + public void testKt42533() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInUntil/kt42533.kt"); + } } @TestMetadata("compiler/testData/codegen/box/ranges/forWithPossibleOverflow")