diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt index 809496e8ef5..4a6a359f18c 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.IrCall -import org.jetbrains.kotlin.ir.expressions.IrContainerExpression import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrLoop import org.jetbrains.kotlin.ir.expressions.impl.IrDoWhileLoopImpl @@ -374,6 +373,7 @@ internal class WithIndexLoopHeader( private val nestedLoopHeader: ForLoopHeader private val indexVariable: IrVariable private val ownsIndexVariable: Boolean + private val incrementIndexStatement: IrStatement? init { with(builder) { @@ -396,6 +396,7 @@ internal class WithIndexLoopHeader( ) { indexVariable = nestedLoopHeader.inductionVariable ownsIndexVariable = false + incrementIndexStatement = null } else { indexVariable = scope.createTemporaryVariable( irInt(0), @@ -403,11 +404,26 @@ internal class WithIndexLoopHeader( isMutable = true ) ownsIndexVariable = true + // `index++` during iteration initialization + // TODO: MUSTDO: Check for overflow for Iterable and Sequence (call to checkIndexOverflow()). + val plusFun = indexVariable.type.getClass()!!.functions.first { + it.name == OperatorNameConventions.PLUS && + it.valueParameters.size == 1 && + it.valueParameters[0].type.isInt() + } + incrementIndexStatement = + irSetVar( + indexVariable.symbol, irCallOp( + plusFun.symbol, plusFun.returnType, + irGet(indexVariable), + irInt(1) + ) + ) } } } - // Add the index variable to the statements from the nested loop header. + // Add the index variable (if owned) to the statements from the nested loop header. override val loopInitStatements = nestedLoopHeader.loopInitStatements.let { if (ownsIndexVariable) it + indexVariable else it } override val consumesLoopVariableComponents = true @@ -459,10 +475,10 @@ internal class WithIndexLoopHeader( // if (inductionVar <= last) { // do { // val i = index // ADDED + // checkIndexOverflow(index++) // ADDED // val v = inductionVar // inductionVar += step // // Loop body - // checkIndexOverflow(index++) // ADDED // } while (inductionVar <= last) // } // @@ -478,13 +494,14 @@ internal class WithIndexLoopHeader( // var index = 0 // while (it.hasNext()) // val i = index - // val v = it.next() // checkIndexOverflow(index++) + // val v = it.next() + // // Loop body // } // // We "wire" the 1st destructured component to index, and the 2nd to the loop variable value from the underlying iterable. loopVariableComponents[1]?.initializer = irGet(indexVariable) - listOfNotNull(loopVariableComponents[1]) + nestedLoopHeader.initializeIteration( + listOfNotNull(loopVariableComponents[1], incrementIndexStatement) + nestedLoopHeader.initializeIteration( loopVariableComponents[2], linkedMapOf(), symbols, @@ -494,28 +511,7 @@ internal class WithIndexLoopHeader( // Use the nested loop header to build the loop. More info in comments in initializeIteration(). override fun buildLoop(builder: DeclarationIrBuilder, oldLoop: IrLoop, newBody: IrExpression?) = - nestedLoopHeader.buildLoop(builder, oldLoop, newBody).apply { - if (ownsIndexVariable) { - with(builder) { - // Add `index++` to end of the loop. - // TODO: MUSTDO: Check for overflow for Iterable and Sequence (call to checkIndexOverflow()). - val plusFun = indexVariable.type.getClass()!!.functions.first { - it.name == OperatorNameConventions.PLUS && - it.valueParameters.size == 1 && - it.valueParameters[0].type.isInt() - } - (newLoop.body as IrContainerExpression).statements.add( - irSetVar( - indexVariable.symbol, irCallOp( - plusFun.symbol, plusFun.returnType, - irGet(indexVariable), - irInt(1) - ) - ) - ) - } - } - } + nestedLoopHeader.buildLoop(builder, oldLoop, newBody) } internal class IterableLoopHeader( diff --git a/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt new file mode 100644 index 00000000000..7cfd32cf3da --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt @@ -0,0 +1,18 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +val arr = arrayOf("a", "b", "c", "d") + +fun box(): String { + val s = StringBuilder() + + for ((index, x) in arr.withIndex()) { + if (index == 0) continue + if (index == 3) break + s.append("$index:$x;") + } + + val ss = s.toString() + return if (ss == "1:b;2:c;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt b/compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt new file mode 100644 index 00000000000..65afce83650 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt @@ -0,0 +1,18 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +val cs: CharSequence = "abcd" + +fun box(): String { + val s = StringBuilder() + + for ((index, x) in cs.withIndex()) { + if (index == 0) continue + if (index == 3) break + s.append("$index:$x;") + } + + val ss = s.toString() + return if (ss == "1:b;2:c;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt b/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt new file mode 100644 index 00000000000..b98f3e98478 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt @@ -0,0 +1,18 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +val xs = listOf("a", "b", "c", "d") + +fun box(): String { + val s = StringBuilder() + + for ((index, x) in xs.withIndex()) { + if (index == 0) continue + if (index == 3) break + s.append("$index:$x;") + } + + val ss = s.toString() + return if (ss == "1:b;2:c;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt b/compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt new file mode 100644 index 00000000000..ab0f05e4ed1 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt @@ -0,0 +1,18 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +val xs = listOf("a", "b", "c", "d").asSequence() + +fun box(): String { + val s = StringBuilder() + + for ((index, x) in xs.withIndex()) { + if (index == 0) continue + if (index == 3) break + s.append("$index:$x;") + } + + val ss = s.toString() + return if (ss == "1:b;2:c;") "OK" else "fail: '$ss'" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt b/compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt new file mode 100644 index 00000000000..b4bb07945cb --- /dev/null +++ b/compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt @@ -0,0 +1,20 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +import kotlin.test.assertEquals + +fun box(): String { + val indexList = mutableListOf() + val valueList = mutableListOf() + for ((i, v) in (4..11 step 2).withIndex()) { + if (i == 0) continue + if (i == 3) break + indexList += i + valueList += v + } + assertEquals(listOf(1, 2), indexList) + assertEquals(listOf(6, 8), valueList) + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index a8d1fe78437..78e04d4aff1 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5414,6 +5414,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt"); } + @TestMetadata("forInArrayWithIndexBreakAndContinue.kt") + public void testForInArrayWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInArrayWithIndexContinuesAsUnmodified.kt") public void testForInArrayWithIndexContinuesAsUnmodified() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexContinuesAsUnmodified.kt"); @@ -5527,6 +5532,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt"); } + @TestMetadata("forInCharSequenceWithIndexBreakAndContinue.kt") + public void testForInCharSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInCharSequenceWithIndexCheckSideEffects.kt") public void testForInCharSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexCheckSideEffects.kt"); @@ -5620,6 +5630,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") + public void testForInListWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -5668,6 +5683,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt"); } + @TestMetadata("forInSequenceWithIndexBreakAndContinue.kt") + public void testForInSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInSequenceWithIndexCheckSideEffects.kt") public void testForInSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexCheckSideEffects.kt"); @@ -20919,6 +20939,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt"); } + @TestMetadata("forInWithIndexBreakAndContinue.kt") + public void testForInWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInWithIndexNoIndexOrElementVar.kt") public void testForInWithIndexNoIndexOrElementVar() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4743e03bd10..4654964862e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5414,6 +5414,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt"); } + @TestMetadata("forInArrayWithIndexBreakAndContinue.kt") + public void testForInArrayWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInArrayWithIndexContinuesAsUnmodified.kt") public void testForInArrayWithIndexContinuesAsUnmodified() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexContinuesAsUnmodified.kt"); @@ -5527,6 +5532,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt"); } + @TestMetadata("forInCharSequenceWithIndexBreakAndContinue.kt") + public void testForInCharSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInCharSequenceWithIndexCheckSideEffects.kt") public void testForInCharSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexCheckSideEffects.kt"); @@ -5620,6 +5630,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") + public void testForInListWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -5668,6 +5683,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt"); } + @TestMetadata("forInSequenceWithIndexBreakAndContinue.kt") + public void testForInSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInSequenceWithIndexCheckSideEffects.kt") public void testForInSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexCheckSideEffects.kt"); @@ -20919,6 +20939,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt"); } + @TestMetadata("forInWithIndexBreakAndContinue.kt") + public void testForInWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInWithIndexNoIndexOrElementVar.kt") public void testForInWithIndexNoIndexOrElementVar() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 4f00726245d..c9cd31e41f4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -5384,6 +5384,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt"); } + @TestMetadata("forInArrayWithIndexBreakAndContinue.kt") + public void testForInArrayWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInArrayWithIndexContinuesAsUnmodified.kt") public void testForInArrayWithIndexContinuesAsUnmodified() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexContinuesAsUnmodified.kt"); @@ -5497,6 +5502,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt"); } + @TestMetadata("forInCharSequenceWithIndexBreakAndContinue.kt") + public void testForInCharSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInCharSequenceWithIndexCheckSideEffects.kt") public void testForInCharSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexCheckSideEffects.kt"); @@ -5590,6 +5600,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") + public void testForInListWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -5638,6 +5653,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt"); } + @TestMetadata("forInSequenceWithIndexBreakAndContinue.kt") + public void testForInSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInSequenceWithIndexCheckSideEffects.kt") public void testForInSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexCheckSideEffects.kt"); @@ -19428,6 +19448,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt"); } + @TestMetadata("forInWithIndexBreakAndContinue.kt") + public void testForInWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInWithIndexNoIndexOrElementVar.kt") public void testForInWithIndexNoIndexOrElementVar() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 96cfa7b083a..37758a6cf99 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5384,6 +5384,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt"); } + @TestMetadata("forInArrayWithIndexBreakAndContinue.kt") + public void testForInArrayWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInArrayWithIndexContinuesAsUnmodified.kt") public void testForInArrayWithIndexContinuesAsUnmodified() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexContinuesAsUnmodified.kt"); @@ -5497,6 +5502,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt"); } + @TestMetadata("forInCharSequenceWithIndexBreakAndContinue.kt") + public void testForInCharSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInCharSequenceWithIndexCheckSideEffects.kt") public void testForInCharSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexCheckSideEffects.kt"); @@ -5590,6 +5600,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") + public void testForInListWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -5638,6 +5653,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt"); } + @TestMetadata("forInSequenceWithIndexBreakAndContinue.kt") + public void testForInSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInSequenceWithIndexCheckSideEffects.kt") public void testForInSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexCheckSideEffects.kt"); @@ -19428,6 +19448,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt"); } + @TestMetadata("forInWithIndexBreakAndContinue.kt") + public void testForInWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInWithIndexNoIndexOrElementVar.kt") public void testForInWithIndexNoIndexOrElementVar() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt"); 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 a6cbe037a75..fb60cbea070 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 @@ -4469,6 +4469,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt"); } + @TestMetadata("forInArrayWithIndexBreakAndContinue.kt") + public void testForInArrayWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInArrayWithIndexContinuesAsUnmodified.kt") public void testForInArrayWithIndexContinuesAsUnmodified() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexContinuesAsUnmodified.kt"); @@ -4582,6 +4587,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt"); } + @TestMetadata("forInCharSequenceWithIndexBreakAndContinue.kt") + public void testForInCharSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInCharSequenceWithIndexCheckSideEffects.kt") public void testForInCharSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexCheckSideEffects.kt"); @@ -4675,6 +4685,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") + public void testForInListWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -4718,6 +4733,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt"); } + @TestMetadata("forInSequenceWithIndexBreakAndContinue.kt") + public void testForInSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInSequenceWithIndexCheckSideEffects.kt") public void testForInSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexCheckSideEffects.kt"); @@ -16399,6 +16419,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt"); } + @TestMetadata("forInWithIndexBreakAndContinue.kt") + public void testForInWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInWithIndexNoIndexOrElementVar.kt") public void testForInWithIndexNoIndexOrElementVar() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.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 6d67e407fb6..89c8e8e40c9 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 @@ -4469,6 +4469,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt"); } + @TestMetadata("forInArrayWithIndexBreakAndContinue.kt") + public void testForInArrayWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInArrayWithIndexContinuesAsUnmodified.kt") public void testForInArrayWithIndexContinuesAsUnmodified() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayWithIndexContinuesAsUnmodified.kt"); @@ -4582,6 +4587,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt"); } + @TestMetadata("forInCharSequenceWithIndexBreakAndContinue.kt") + public void testForInCharSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInCharSequenceWithIndexCheckSideEffects.kt") public void testForInCharSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInCharSequenceWithIndex/forInCharSequenceWithIndexCheckSideEffects.kt"); @@ -4675,6 +4685,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") + public void testForInListWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -4718,6 +4733,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndex.kt"); } + @TestMetadata("forInSequenceWithIndexBreakAndContinue.kt") + public void testForInSequenceWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInSequenceWithIndexCheckSideEffects.kt") public void testForInSequenceWithIndexCheckSideEffects() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex/forInSequenceWithIndexCheckSideEffects.kt"); @@ -16504,6 +16524,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt"); } + @TestMetadata("forInWithIndexBreakAndContinue.kt") + public void testForInWithIndexBreakAndContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexBreakAndContinue.kt"); + } + @TestMetadata("forInWithIndexNoIndexOrElementVar.kt") public void testForInWithIndexNoIndexOrElementVar() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt");