diff --git a/compiler/testData/codegen/box/arrays/arrayInstanceOf.kt b/compiler/testData/codegen/box/arrays/arrayInstanceOf.kt index 384bd293741..406b97e57a4 100644 --- a/compiler/testData/codegen/box/arrays/arrayInstanceOf.kt +++ b/compiler/testData/codegen/box/arrays/arrayInstanceOf.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - //test [], get and iterator calls fun test(createIntNotLong: Boolean): String { val a = if (createIntNotLong) IntArray(5) else LongArray(5) @@ -24,5 +22,8 @@ fun test(createIntNotLong: Boolean): String { } fun box(): String { + // Only run this test if primitive array `is` checks work (KT-17137) + if ((intArrayOf() as Any) is Array<*>) return "OK" + return test(true) + test(false) } \ No newline at end of file diff --git a/compiler/testData/codegen/box/arrays/kt2997.kt b/compiler/testData/codegen/box/arrays/kt2997.kt index 01fb0d954b2..ac70c009a2d 100644 --- a/compiler/testData/codegen/box/arrays/kt2997.kt +++ b/compiler/testData/codegen/box/arrays/kt2997.kt @@ -1,6 +1,4 @@ //KT-2997 Automatically cast error (Array) -// IGNORE_BACKEND_WITHOUT_CHECK: JS -// Unmute when JS implements primitive arrays via TypedArray fun foo(a: Any): Int { if (a is IntArray) { @@ -55,6 +53,9 @@ fun foo(a: Any): Int { } fun box(): String { + // Only run this test if primitive array `is` checks work (KT-17137) + if ((intArrayOf() as Any) is Array<*>) return "OK" + val iA = IntArray(1) if (foo(iA) != 1) return "fail int[]" val sA = ShortArray(1) diff --git a/compiler/testData/codegen/box/arrays/kt7288.kt b/compiler/testData/codegen/box/arrays/kt7288.kt index 81671432759..2c387e56cf9 100644 --- a/compiler/testData/codegen/box/arrays/kt7288.kt +++ b/compiler/testData/codegen/box/arrays/kt7288.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS - fun test(b: Boolean): String { val a = if (b) IntArray(5) else LongArray(5) if (a is IntArray) { @@ -23,6 +21,9 @@ fun test(b: Boolean): String { } fun box(): String { + // Only run this test if primitive array `is` checks work (KT-17137) + if ((intArrayOf() as Any) is Array<*>) return "OK" + if (test(true) != "OK") return "fail 1: ${test(true)}" if (test(false) != "OK") return "fail 1: ${test(false)}" diff --git a/compiler/testData/codegen/box/ranges/forInIndices/kt13241_Array.kt b/compiler/testData/codegen/box/ranges/forInIndices/kt13241_Array.kt index 8991023a287..47b299b9a5c 100644 --- a/compiler/testData/codegen/box/ranges/forInIndices/kt13241_Array.kt +++ b/compiler/testData/codegen/box/ranges/forInIndices/kt13241_Array.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_WITHOUT_CHECK: JS // WITH_RUNTIME import kotlin.test.assertEquals @@ -14,6 +13,9 @@ fun test(x: Any): Int { } fun box(): String { + // Only run this test if primitive array `is` checks work (KT-17137) + if ((intArrayOf() as Any) is Array<*>) return "OK" + assertEquals(123, test(intArrayOf(0, 0, 0, 0))) return "OK" } \ No newline at end of file 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 e080416474d..8b07abd18b9 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 @@ -391,24 +391,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Arrays extends AbstractJsCodegenBoxTest { - @TestMetadata("arrayInstanceOf.kt") - public void ignoreArrayInstanceOf() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/arrayInstanceOf.kt"); - doTest(fileName); - } - - @TestMetadata("kt2997.kt") - public void ignoreKt2997() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt2997.kt"); - doTest(fileName); - } - - @TestMetadata("kt7288.kt") - public void ignoreKt7288() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt7288.kt"); - doTest(fileName); - } - public void testAllFilesPresentInArrays() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/arrays"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); } @@ -431,6 +413,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("arrayInstanceOf.kt") + public void testArrayInstanceOf() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/arrayInstanceOf.kt"); + doTest(fileName); + } + @TestMetadata("arrayPlusAssign.kt") public void testArrayPlusAssign() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/arrayPlusAssign.kt"); @@ -653,6 +641,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("kt2997.kt") + public void testKt2997() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt2997.kt"); + doTest(fileName); + } + @TestMetadata("kt33.kt") public void testKt33() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt33.kt"); @@ -719,6 +713,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("kt7288.kt") + public void testKt7288() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt7288.kt"); + doTest(fileName); + } + @TestMetadata("kt7338.kt") public void testKt7338() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt7338.kt"); @@ -14912,12 +14912,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class ForInIndices extends AbstractJsCodegenBoxTest { - @TestMetadata("kt13241_Array.kt") - public void ignoreKt13241_Array() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Array.kt"); - doTest(fileName); - } - public void testAllFilesPresentInForInIndices() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInIndices"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); } @@ -14994,6 +14988,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("kt13241_Array.kt") + public void testKt13241_Array() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInIndices/kt13241_Array.kt"); + doTest(fileName); + } + @TestMetadata("kt13241_CharSequence.kt") public void testKt13241_CharSequence() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInIndices/kt13241_CharSequence.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsTypedArraysBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsTypedArraysBoxTestGenerated.java index 9c56404731d..106c6706611 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsTypedArraysBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsTypedArraysBoxTestGenerated.java @@ -32,24 +32,6 @@ import java.util.regex.Pattern; @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class JsTypedArraysBoxTestGenerated extends AbstractJsTypedArraysBoxTest { - @TestMetadata("arrayInstanceOf.kt") - public void ignoreArrayInstanceOf() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/arrayInstanceOf.kt"); - doTest(fileName); - } - - @TestMetadata("kt2997.kt") - public void ignoreKt2997() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt2997.kt"); - doTest(fileName); - } - - @TestMetadata("kt7288.kt") - public void ignoreKt7288() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt7288.kt"); - doTest(fileName); - } - public void testAllFilesPresentInArrays() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/arrays"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); } @@ -72,6 +54,12 @@ public class JsTypedArraysBoxTestGenerated extends AbstractJsTypedArraysBoxTest doTest(fileName); } + @TestMetadata("arrayInstanceOf.kt") + public void testArrayInstanceOf() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/arrayInstanceOf.kt"); + doTest(fileName); + } + @TestMetadata("arrayPlusAssign.kt") public void testArrayPlusAssign() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/arrayPlusAssign.kt"); @@ -294,6 +282,12 @@ public class JsTypedArraysBoxTestGenerated extends AbstractJsTypedArraysBoxTest doTest(fileName); } + @TestMetadata("kt2997.kt") + public void testKt2997() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt2997.kt"); + doTest(fileName); + } + @TestMetadata("kt33.kt") public void testKt33() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt33.kt"); @@ -360,6 +354,12 @@ public class JsTypedArraysBoxTestGenerated extends AbstractJsTypedArraysBoxTest doTest(fileName); } + @TestMetadata("kt7288.kt") + public void testKt7288() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt7288.kt"); + doTest(fileName); + } + @TestMetadata("kt7338.kt") public void testKt7338() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/kt7338.kt");