diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/AbstractWithIndexForLoopGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/AbstractWithIndexForLoopGenerator.kt index 5feff036f80..2c963a3b391 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/AbstractWithIndexForLoopGenerator.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/AbstractWithIndexForLoopGenerator.kt @@ -29,7 +29,7 @@ abstract class AbstractWithIndexForLoopGenerator( private val bodyEnd = Label() private val leaveTasks = arrayListOf<() -> Unit>() - protected class LoopComponent(val parameterVar: Int, val parameterType: Type, val elementType: Type) + protected class LoopComponent(val parameterVar: Int, val parameterType: Type, val componentType: Type) protected val indexLoopComponent: LoopComponent? = loopParameter.entries.getOrNull(0)?.resolveLoopComponent() protected val elementLoopComponent: LoopComponent? = loopParameter.entries.getOrNull(1)?.resolveLoopComponent() diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/ArrayWithIndexForLoopGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/ArrayWithIndexForLoopGenerator.kt index e7d0b402642..f442104f8bc 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/ArrayWithIndexForLoopGenerator.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/range/forLoop/ArrayWithIndexForLoopGenerator.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.codegen.range.forLoop import org.jetbrains.kotlin.codegen.ExpressionCodegen import org.jetbrains.kotlin.codegen.StackValue import org.jetbrains.kotlin.codegen.generateCallReceiver -import org.jetbrains.kotlin.codegen.range.forLoop.AbstractWithIndexForLoopGenerator import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.psi.KtDestructuringDeclaration import org.jetbrains.kotlin.psi.KtForExpression @@ -25,6 +24,7 @@ class ArrayWithIndexForLoopGenerator( ) : AbstractWithIndexForLoopGenerator(codegen, forExpression, loopParameter, rangeCall) { private val arrayType = codegen.asmType(ExpressionCodegen.getExpectedReceiverType(rangeCall)) + private val arrayElementType = arrayType.elementType private var arrayVar = -1 private var arrayLengthVar = -1 @@ -61,9 +61,9 @@ class ArrayWithIndexForLoopGenerator( if (elementLoopComponent != null) { v.load(arrayVar, AsmTypes.OBJECT_TYPE) v.load(indexVar, Type.INT_TYPE) - v.aload(elementLoopComponent.elementType) - StackValue.local(elementLoopComponent.parameterVar, elementLoopComponent .parameterType) - .store(StackValue.onStack(elementLoopComponent .elementType), v) + v.aload(arrayElementType) + StackValue.local(elementLoopComponent.parameterVar, elementLoopComponent.parameterType) + .store(StackValue.onStack(arrayElementType), v) } } diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt new file mode 100644 index 00000000000..61523d25894 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +val arr = byteArrayOf(10, 20, 30, 40) + +fun foo(xs: Any): String { + if (xs !is ByteArray) return "not a ByteArray" + + val s = StringBuilder() + for ((index, x) in xs.withIndex()) { + s.append("$index:$x;") + } + return s.toString() +} + +fun box(): String { + val ss = foo(arr) + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt new file mode 100644 index 00000000000..7060eafb6d9 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME + +val arr = byteArrayOf(10, 20, 30, 40) + +fun box(): String { + val s = StringBuilder() + for ((index, x) in arr.withIndex()) { + s.append("$index:$x;") + } + val ss = s.toString() + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt new file mode 100644 index 00000000000..c03df2ec3c4 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME + +val arr = arrayOf(10, 20, 30, 40) + +fun box(): String { + val s = StringBuilder() + for ((index, x) in arr.withIndex()) { + s.append("$index:$x;") + } + val ss = s.toString() + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt new file mode 100644 index 00000000000..b9467837e7c --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +val arr = arrayOf(10, 20, 30, 40) + +fun foo(xs: Any): String { + if (xs !is Array<*>) return "not an Array<*>" + + val s = StringBuilder() + for ((index, x) in xs.withIndex()) { + s.append("$index:$x;") + } + return s.toString() +} + +fun box(): String { + val ss = foo(arr) + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt new file mode 100644 index 00000000000..b813712969d --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +val arr = arrayOf(10, 20, 30, 40) + +fun foo(xs: Array): String { + val s = StringBuilder() + for ((index, x) in xs.withIndex()) { + s.append("$index:$x;") + } + return s.toString() +} + +fun box(): String { + val ss = foo(arr) + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt new file mode 100644 index 00000000000..aebff5d02de --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +val arr = intArrayOf(10, 20, 30, 40) + +fun foo(xs: Any): String { + if (xs !is IntArray) return "not an IntArray" + + val s = StringBuilder() + for ((index, x) in xs.withIndex()) { + s.append("$index:$x;") + } + return s.toString() +} + +fun box(): String { + val ss = foo(arr) + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt new file mode 100644 index 00000000000..3f1fa272344 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt @@ -0,0 +1,18 @@ +// WITH_RUNTIME + +val arr = shortArrayOf(10, 20, 30, 40) + +fun foo(xs: Any): String { + if (xs !is ShortArray) return "not a ShortArray" + + val s = StringBuilder() + for ((index, x) in xs.withIndex()) { + s.append("$index:$x;") + } + return s.toString() +} + +fun box(): String { + val ss = foo(arr) + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt new file mode 100644 index 00000000000..49055dc55a3 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME + +val arr = shortArrayOf(10, 20, 30, 40) + +fun box(): String { + val s = StringBuilder() + for ((index, x) in arr.withIndex()) { + s.append("$index:$x;") + } + val ss = s.toString() + return if (ss == "0:10;1:20;2:30;3:40;") "OK" else "fail: '$ss'" +} \ No newline at end of file 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 ee0527eb1fd..3c547f71699 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 @@ -5240,12 +5240,48 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("forInByteArrayWithIndexWithSmartCast.kt") + public void testForInByteArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInByteArrrayWithIndex.kt") + public void testForInByteArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt"); + doTest(fileName); + } + @TestMetadata("forInEmptyArrrayWithIndex.kt") public void testForInEmptyArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInEmptyArrrayWithIndex.kt"); doTest(fileName); } + @TestMetadata("forInGenericArrayOfIntsWithIndex.kt") + public void testForInGenericArrayOfIntsWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayOfIntsWithIndexWithSmartCast.kt") + public void testForInGenericArrayOfIntsWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayWithIndex.kt") + public void testForInGenericArrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInIntArrayWithIndexWithSmartCast.kt") + public void testForInIntArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + @TestMetadata("forInIntArrrayWithIndex.kt") public void testForInIntArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrrayWithIndex.kt"); @@ -5257,6 +5293,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInObjectArrrayWithIndex.kt"); doTest(fileName); } + + @TestMetadata("forInShortArrayWithIndexWithSmartCast.kt") + public void testForInShortArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInShortArrrayWithIndex.kt") + public void testForInShortArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index ab5681d8165..ac95c722fa0 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5240,12 +5240,48 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("forInByteArrayWithIndexWithSmartCast.kt") + public void testForInByteArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInByteArrrayWithIndex.kt") + public void testForInByteArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt"); + doTest(fileName); + } + @TestMetadata("forInEmptyArrrayWithIndex.kt") public void testForInEmptyArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInEmptyArrrayWithIndex.kt"); doTest(fileName); } + @TestMetadata("forInGenericArrayOfIntsWithIndex.kt") + public void testForInGenericArrayOfIntsWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayOfIntsWithIndexWithSmartCast.kt") + public void testForInGenericArrayOfIntsWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayWithIndex.kt") + public void testForInGenericArrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInIntArrayWithIndexWithSmartCast.kt") + public void testForInIntArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + @TestMetadata("forInIntArrrayWithIndex.kt") public void testForInIntArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrrayWithIndex.kt"); @@ -5257,6 +5293,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInObjectArrrayWithIndex.kt"); doTest(fileName); } + + @TestMetadata("forInShortArrayWithIndexWithSmartCast.kt") + public void testForInShortArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInShortArrrayWithIndex.kt") + public void testForInShortArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 9959f4c1bd2..d2177ccdbdc 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5240,12 +5240,48 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } + @TestMetadata("forInByteArrayWithIndexWithSmartCast.kt") + public void testForInByteArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInByteArrrayWithIndex.kt") + public void testForInByteArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt"); + doTest(fileName); + } + @TestMetadata("forInEmptyArrrayWithIndex.kt") public void testForInEmptyArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInEmptyArrrayWithIndex.kt"); doTest(fileName); } + @TestMetadata("forInGenericArrayOfIntsWithIndex.kt") + public void testForInGenericArrayOfIntsWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayOfIntsWithIndexWithSmartCast.kt") + public void testForInGenericArrayOfIntsWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayWithIndex.kt") + public void testForInGenericArrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInIntArrayWithIndexWithSmartCast.kt") + public void testForInIntArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + @TestMetadata("forInIntArrrayWithIndex.kt") public void testForInIntArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrrayWithIndex.kt"); @@ -5257,6 +5293,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInObjectArrrayWithIndex.kt"); doTest(fileName); } + + @TestMetadata("forInShortArrayWithIndexWithSmartCast.kt") + public void testForInShortArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInShortArrrayWithIndex.kt") + public void testForInShortArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex") 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 18eead615b0..3a9b4e4a078 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 @@ -5828,12 +5828,48 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("forInByteArrayWithIndexWithSmartCast.kt") + public void testForInByteArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInByteArrrayWithIndex.kt") + public void testForInByteArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInByteArrrayWithIndex.kt"); + doTest(fileName); + } + @TestMetadata("forInEmptyArrrayWithIndex.kt") public void testForInEmptyArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInEmptyArrrayWithIndex.kt"); doTest(fileName); } + @TestMetadata("forInGenericArrayOfIntsWithIndex.kt") + public void testForInGenericArrayOfIntsWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayOfIntsWithIndexWithSmartCast.kt") + public void testForInGenericArrayOfIntsWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayOfIntsWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInGenericArrayWithIndex.kt") + public void testForInGenericArrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInGenericArrayWithIndex.kt"); + doTest(fileName); + } + + @TestMetadata("forInIntArrayWithIndexWithSmartCast.kt") + public void testForInIntArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + @TestMetadata("forInIntArrrayWithIndex.kt") public void testForInIntArrrayWithIndex() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInIntArrrayWithIndex.kt"); @@ -5845,6 +5881,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInObjectArrrayWithIndex.kt"); doTest(fileName); } + + @TestMetadata("forInShortArrayWithIndexWithSmartCast.kt") + public void testForInShortArrayWithIndexWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrayWithIndexWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("forInShortArrrayWithIndex.kt") + public void testForInShortArrrayWithIndex() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInShortArrrayWithIndex.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex")