diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 75473e44ef5..0edd2866660 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -8763,12 +8763,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @Test + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @Test @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @Test + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @Test @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { @@ -30144,6 +30156,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @Test @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { @@ -31221,6 +31239,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @Test + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @Test + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @Test + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @Test @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendContext.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendContext.kt index ae05330c6fb..f7d3a26b368 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendContext.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CommonBackendContext.kt @@ -56,9 +56,6 @@ interface CommonBackendContext : BackendContext, LoggingContext { val preferJavaLikeCounterLoop: Boolean get() = false - val reuseLoopVariableAsInductionVariable: Boolean - get() = false - val doWhileCounterLoopOrigin: IrStatementOrigin? get() = null diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt index 98cee8dd39b..4636053793b 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt @@ -8,18 +8,16 @@ package org.jetbrains.kotlin.backend.common.lower.loops import org.jetbrains.kotlin.backend.common.BodyLoweringPass import org.jetbrains.kotlin.backend.common.CommonBackendContext import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext -import org.jetbrains.kotlin.backend.common.lower.AbstractVariableRemapper import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl +import org.jetbrains.kotlin.ir.declarations.IrDeclaration +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrSymbolOwner +import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrCompositeImpl -import org.jetbrains.kotlin.ir.symbols.impl.IrVariableSymbolImpl -import org.jetbrains.kotlin.ir.types.classifierOrNull -import org.jetbrains.kotlin.ir.types.isNullable import org.jetbrains.kotlin.ir.util.dump import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.ir.visitors.* @@ -190,102 +188,9 @@ private class RangeLoopTransformer( statements[0] = loweredHeader statements[1] = loopReplacementExpression - if (context.reuseLoopVariableAsInductionVariable && loopHeader.canReuseLoopVariableAsInductionVariable) { - reuseLoopVariableAsInductionVariable(expression) - } - return super.visitBlock(expression) } - private fun reuseLoopVariableAsInductionVariable(irBlock: IrBlock) { - // Given a loop in the form: - // { - // var inductionVariable = - // } - // do { - // if (!()) break - // val loopVariable = inductionVariable - // - // } while ( { inductionVariable += ; true } ) - // replace it with: - // { - // var loopVariable' = - // } - // do { - // if (!()) break - // - // } while ( { loopVariable' += ; true } ) - // where whenLoopCondition' and originalLoopBody' are corresponding statements - // with inductionVariable and loopVariable remapped to loopVariable'. - // - // NB we can do so only with a do-while counter loop as described above, - // otherwise it changes semantics of 'continue' inside the loop. - - val header = irBlock.statements[0] as? IrStatementContainer ?: return - - val inductionVariableIndex = header.statements.indexOfFirst { it.isInductionVariable(context) } - if (inductionVariableIndex < 0) return - val inductionVariable = header.statements[inductionVariableIndex] as IrVariable - - val innerLoop = findInnerDoWhileLoop(irBlock.statements[1]) ?: return - if (innerLoop.origin != context.doWhileCounterLoopOrigin) return - val loopVariableContainerAndIndex = findLoopVariable(innerLoop) ?: return - val (loopVariableContainer, loopVariableIndex) = loopVariableContainerAndIndex - val loopVariable = loopVariableContainer.statements[loopVariableIndex] as IrVariable - - val inductionVariableType = inductionVariable.type - val loopVariableType = loopVariable.type - if (loopVariableType.isNullable()) return - if (loopVariableType.classifierOrNull != inductionVariableType.classifierOrNull) return - - val newLoopVariable = IrVariableImpl( - loopVariable.startOffset, loopVariable.endOffset, loopVariable.origin, - IrVariableSymbolImpl(), - loopVariable.name, loopVariableType, - isVar = true, // NB original loop variable is 'val' - isConst = false, isLateinit = false - ) - newLoopVariable.initializer = inductionVariable.initializer - - header.statements[inductionVariableIndex] = newLoopVariable - loopVariableContainer.statements.removeAt(loopVariableIndex) - - val remapper = object : AbstractVariableRemapper() { - override fun remapVariable(value: IrValueDeclaration): IrValueDeclaration? = - if (value == inductionVariable || value == loopVariable) newLoopVariable else null - } - irBlock.statements[1].transformChildren(remapper, null) - } - - private fun findInnerDoWhileLoop(statement: IrStatement): IrDoWhileLoop? { - if (statement is IrDoWhileLoop) { - return statement - } - if (statement is IrWhen) { - val branch0Result = statement.branches[0].result - if (branch0Result is IrDoWhileLoop) - return branch0Result - } - return null - } - - private fun findLoopVariable(doWhileLoop: IrDoWhileLoop): Pair? { - val loopBody = doWhileLoop.body as? IrContainerExpression ?: return null - for ((index, statement) in loopBody.statements.withIndex()) { - if (statement.isLoopVariable()) - return Pair(loopBody, index) - else if (statement is IrContainerExpression && statement.origin == IrStatementOrigin.FOR_LOOP_NEXT) { - val loopVarIndex = statement.statements.indexOfFirst { it.isLoopVariable() } - if (loopVarIndex < 0) return null - return Pair(statement, loopVarIndex) - } - } - return null - } - - private fun IrStatement.isLoopVariable() = - this is IrVariable && origin == IrDeclarationOrigin.FOR_LOOP_VARIABLE - /** * Lowers the "header" statement that stores the iterator into the loop variable * (e.g., `val it = someIterable.iterator()`) and gather information for building the for-loop 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 fae8f109851..ceb99900666 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 @@ -44,10 +44,6 @@ interface ForLoopHeader { */ val consumesLoopVariableComponents: Boolean - /** `true` if it's possible to use loop variable as induction variable in this kind of loop */ - val canReuseLoopVariableAsInductionVariable: Boolean - get() = false - /** Statements used to initialize an iteration of the loop (e.g., assign loop variable). */ fun initializeIteration( loopVariable: IrVariable?, @@ -62,7 +58,7 @@ interface ForLoopHeader { internal const val inductionVariableName = "inductionVariable" -internal fun IrStatement.isInductionVariable(context: CommonBackendContext) = +fun IrStatement.isInductionVariable(context: CommonBackendContext) = this is IrVariable && origin == context.inductionVariableOrigin && name.asString() == inductionVariableName @@ -75,8 +71,6 @@ abstract class NumericForLoopHeader( override val consumesLoopVariableComponents = false - override val canReuseLoopVariableAsInductionVariable get() = true - val inductionVariable: IrVariable protected val stepVariable: IrVariable? @@ -445,51 +439,56 @@ class ProgressionLoopHeader( ): LoopReplacement { // Transform loop: // while () { - // { - // - // inductionVariable += step + // { // FOR_LOOP_NEXT + // + // // } // // } // to: // do { - // if (!()) break - // val forLoopVariable = inductionVariable + // { // FOR_LOOP_NEXT + // if (!()) break + // + // } // - // } while ( { inductionVariable += step; true } ) + // } while ( + // { + // + // true + // } + // ) val bodyBlock = newBody as? IrContainerExpression ?: throw AssertionError("newBody: ${newBody?.dump()}") val forLoopNextBlock = bodyBlock.statements[0] as? IrContainerExpression ?: throw AssertionError("bodyBlock[0]: ${bodyBlock.statements[0].dump()}") if (forLoopNextBlock.origin != IrStatementOrigin.FOR_LOOP_NEXT) throw AssertionError("FOR_LOOP_NEXT expected: ${forLoopNextBlock.dump()}") - val loopStep = forLoopNextBlock.statements.last() as? IrSetValue + val inductionVariableUpdate = forLoopNextBlock.statements.last() as? IrSetValue ?: throw AssertionError("forLoopNextBlock.last: ${forLoopNextBlock.statements.last().dump()}") val doWhileLoop = IrDoWhileLoopImpl(oldLoop.startOffset, oldLoop.endOffset, oldLoop.type, context.doWhileCounterLoopOrigin) doWhileLoop.label = oldLoop.label - val negatedConditionCheck = createNegatedConditionCheck(newLoopCondition, doWhileLoop) + bodyBlock.statements[0] = IrCompositeImpl( + forLoopNextBlock.startOffset, forLoopNextBlock.endOffset, + forLoopNextBlock.type, + forLoopNextBlock.origin, + ).apply { + statements.add(createNegatedConditionCheck(newLoopCondition, doWhileLoop)) + if (forLoopNextBlock.statements.size >= 2) + statements.addAll(forLoopNextBlock.statements.subList(0, forLoopNextBlock.statements.lastIndex)) + } - bodyBlock.statements[0] = negatedConditionCheck - val loopVarAssignments = - if (forLoopNextBlock.statements.size == 2) - forLoopNextBlock.statements[0] - else - IrCompositeImpl( - forLoopNextBlock.startOffset, forLoopNextBlock.endOffset, forLoopNextBlock.type, null, - forLoopNextBlock.statements.subList(0, forLoopNextBlock.statements.lastIndex) - ) - bodyBlock.statements.add(1, loopVarAssignments) doWhileLoop.body = bodyBlock - val stepStartOffset = loopStep.startOffset - val stepEndOffset = loopStep.endOffset + val stepStartOffset = inductionVariableUpdate.startOffset + val stepEndOffset = inductionVariableUpdate.endOffset val doWhileCondition = IrCompositeImpl( stepStartOffset, stepEndOffset, context.irBuiltIns.booleanType, null, listOf( - loopStep, + inductionVariableUpdate, IrConstImpl.boolean(stepStartOffset, stepEndOffset, context.irBuiltIns.booleanType, true) ) ) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt index 1a577acacf1..1d1caa6ccf3 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmBackendContext.kt @@ -218,9 +218,6 @@ class JvmBackendContext( override val preferJavaLikeCounterLoop: Boolean get() = true - override val reuseLoopVariableAsInductionVariable: Boolean - get() = true - override val doWhileCounterLoopOrigin: IrStatementOrigin get() = JvmLoweredStatementOrigin.DO_WHILE_COUNTER_LOOP diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOptimizationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOptimizationLowering.kt index 8c15a12892d..218fb2b3df5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOptimizationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOptimizationLowering.kt @@ -6,22 +6,27 @@ package org.jetbrains.kotlin.backend.jvm.lower import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.lower.AbstractVariableRemapper import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.lower.irBlock +import org.jetbrains.kotlin.backend.common.lower.loops.isInductionVariable import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext +import org.jetbrains.kotlin.backend.jvm.JvmLoweredStatementOrigin import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.symbols.impl.IrPublicSymbolBase +import org.jetbrains.kotlin.ir.symbols.impl.IrVariableSymbolImpl import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementTransformer @@ -410,11 +415,77 @@ class JvmOptimizationLowering(val context: JvmBackendContext) : FileLoweringPass expression.rewritePostfixIncrDecr()?.let { return it } } + if (expression.origin == IrStatementOrigin.FOR_LOOP) { + reuseLoopVariableAsInductionVariableIfPossible(expression) + } + expression.transformChildren(this, data) removeUnnecessaryTemporaryVariables(expression.statements) return expression } + private fun reuseLoopVariableAsInductionVariableIfPossible(irForLoopBlock: IrContainerExpression) { + if (irForLoopBlock.statements.size != 2) return + + val loopInitialization = irForLoopBlock.statements[0] as? IrComposite ?: return + val inductionVariableIndex = loopInitialization.statements.indexOfFirst { it.isInductionVariable(context) } + if (inductionVariableIndex < 0) return + val inductionVariable = loopInitialization.statements[inductionVariableIndex] as? IrVariable ?: return + + val loopVariablePosition = findLoopVariablePosition(irForLoopBlock.statements[1]) ?: return + val (loopVariableContainer, loopVariableIndex) = loopVariablePosition + val loopVariable = loopVariableContainer.statements[loopVariableIndex] as? IrVariable ?: return + + val inductionVariableType = inductionVariable.type + val loopVariableType = loopVariable.type + if (loopVariableType.isNullable()) return + if (loopVariableType.classifierOrNull != inductionVariableType.classifierOrNull) return + + val newLoopVariable = IrVariableImpl( + loopVariable.startOffset, loopVariable.endOffset, loopVariable.origin, + IrVariableSymbolImpl(), + loopVariable.name, loopVariableType, + isVar = true, // NB original loop variable is 'val' + isConst = false, isLateinit = false + ) + newLoopVariable.initializer = inductionVariable.initializer + + loopInitialization.statements[inductionVariableIndex] = newLoopVariable + loopVariableContainer.statements.removeAt(loopVariableIndex) + val remapper = object : AbstractVariableRemapper() { + override fun remapVariable(value: IrValueDeclaration): IrValueDeclaration? = + if (value == inductionVariable || value == loopVariable) newLoopVariable else null + } + irForLoopBlock.statements[1].transformChildren(remapper, null) + } + + private fun findLoopVariablePosition(statement: IrStatement): Pair? { + when (statement) { + is IrDoWhileLoop -> { + // Expecting counter loop + val doWhileLoop = statement as? IrDoWhileLoop ?: return null + if (doWhileLoop.origin != JvmLoweredStatementOrigin.DO_WHILE_COUNTER_LOOP) return null + val doWhileLoopBody = doWhileLoop.body as? IrComposite ?: return null + if (doWhileLoopBody.origin != IrStatementOrigin.FOR_LOOP_INNER_WHILE) return null + val iterationInitialization = doWhileLoopBody.statements[0] as? IrComposite ?: return null + val loopVariableIndex = iterationInitialization.statements.indexOfFirst { it.isLoopVariable() } + if (loopVariableIndex < 0) return null + return iterationInitialization to loopVariableIndex + } + is IrWhen -> { + // Expecting if-guarded counter loop + val doWhileLoop = statement.branches[0].result as? IrDoWhileLoop ?: return null + return findLoopVariablePosition(doWhileLoop) + } + else -> { + return null + } + } + } + + private fun IrStatement.isLoopVariable() = + this is IrVariable && origin == IrDeclarationOrigin.FOR_LOOP_VARIABLE + private fun IrContainerExpression.rewritePostfixIncrDecr(): IrCall? { return when (origin) { IrStatementOrigin.POSTFIX_INCR, IrStatementOrigin.POSTFIX_DECR -> { diff --git a/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt b/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt new file mode 100644 index 00000000000..d42fd6c9aab --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt @@ -0,0 +1,19 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: STDLIB_GENERATED +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +fun test(xs: List): String { + var r = "" + for ((i, x) in xs.withIndex()) { + if (i > 1) break + r += "$i:$x;" + } + return r +} + +fun box(): String { + val t = test(listOf("a", "b", "c", "d", "e")) + if (t != "0:a;1:b;") return "Failed: $t" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt b/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt new file mode 100644 index 00000000000..6b3bad0e249 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt @@ -0,0 +1,19 @@ +// DONT_TARGET_EXACT_BACKEND: WASM +// WASM_MUTE_REASON: STDLIB_GENERATED +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +fun test(xs: List): String { + var r = "" + for ((i, x) in xs.withIndex()) { + if (i % 2 == 0) continue + r += "$i:$x;" + } + return r +} + +fun box(): String { + val t = test(listOf("a", "b", "c", "d", "e")) + if (t != "1:b;3:d;") return "Failed: $t" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/ranges/capturedLoopVar.kt b/compiler/testData/codegen/box/ranges/capturedLoopVar.kt new file mode 100644 index 00000000000..f410afa672f --- /dev/null +++ b/compiler/testData/codegen/box/ranges/capturedLoopVar.kt @@ -0,0 +1,16 @@ +// IGNORE_BACKEND: WASM +// WITH_RUNTIME + +fun build(): List<() -> Int> { + val r = ArrayList<() -> Int>() + for (i in 0 until 3) { + r.add({ i }) + } + return r +} + +fun box(): String { + val t = build().map { it() } + if (t != listOf(0, 1, 2)) return "Failed: $t" + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt b/compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt new file mode 100644 index 00000000000..42e63d08b9d --- /dev/null +++ b/compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt @@ -0,0 +1,13 @@ +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +fun test(xs: List): String { + var r = "" + for (i in xs.indices) { + r += xs[i] + } + return r +} + +fun box(): String = + test(listOf("OK")) diff --git a/compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt b/compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt new file mode 100644 index 00000000000..f682188e949 --- /dev/null +++ b/compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt @@ -0,0 +1,14 @@ +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +fun test(xs: List): String { + var r = "" + for (i in xs.indices) { + if (i > 1) break + r += xs[i] + } + return r +} + +fun box(): String = + test(listOf("O", "K", "2", "3", "4")) diff --git a/compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt b/compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt new file mode 100644 index 00000000000..1076a7a0fda --- /dev/null +++ b/compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt @@ -0,0 +1,14 @@ +// KJS_WITH_FULL_RUNTIME +// WITH_RUNTIME + +fun test(xs: List): String { + var r = "" + for (i in xs.indices) { + if (i % 2 == 0) continue + r += xs[i] + } + return r +} + +fun box(): String = + test(listOf("0", "O", "2", "K", "4")) diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 3b5f93fcae4..0944faff23a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -8691,12 +8691,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @Test + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @Test @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @Test + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @Test @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { @@ -30018,6 +30030,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @Test + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @Test @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { @@ -31095,6 +31113,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @Test + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @Test + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @Test + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @Test @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index f3855957dd8..292ff0fadb5 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -8763,12 +8763,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @Test + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @Test @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @Test + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @Test @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { @@ -30144,6 +30156,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @Test @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { @@ -31221,6 +31239,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @Test + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @Test + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @Test + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @Test @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 122c2e72169..3f128d0ea16 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -6732,11 +6732,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -25546,6 +25556,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true, "stepped"); } + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt"); @@ -26485,6 +26500,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 154af17d2ce..6cf82796228 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -5976,11 +5976,21 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -20210,6 +20220,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt"); @@ -21144,6 +21159,21 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 982eda10c93..561fbff7210 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -5382,11 +5382,21 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -19616,6 +19626,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt"); @@ -20550,6 +20565,21 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 3968ab13bf7..d7bbe9bc0b0 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -5362,11 +5362,21 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndex.kt"); } + @TestMetadata("forInListWithIndexBreak.kt") + public void testForInListWithIndexBreak() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreak.kt"); + } + @TestMetadata("forInListWithIndexBreakAndContinue.kt") public void testForInListWithIndexBreakAndContinue() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexBreakAndContinue.kt"); } + @TestMetadata("forInListWithIndexContinue.kt") + public void testForInListWithIndexContinue() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexContinue.kt"); + } + @TestMetadata("forInListWithIndexNoElementVar.kt") public void testForInListWithIndexNoElementVar() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/forInIterableWithIndex/forInListWithIndexNoElementVar.kt"); @@ -19646,6 +19656,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt"); @@ -20580,6 +20595,21 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 37e5a52f9d1..70ab4e14b9a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -12647,6 +12647,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ranges"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true, "stepped/unsigned"); } + @TestMetadata("capturedLoopVar.kt") + public void testCapturedLoopVar() throws Exception { + runTest("compiler/testData/codegen/box/ranges/capturedLoopVar.kt"); + } + @TestMetadata("forByteProgressionWithIntIncrement.kt") public void testForByteProgressionWithIntIncrement() throws Exception { runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt"); @@ -13071,6 +13076,21 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/ranges/forInIndices/forInCollectionTypeParameterIndices.kt"); } + @TestMetadata("forInListIndices.kt") + public void testForInListIndices() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndices.kt"); + } + + @TestMetadata("forInListIndicesBreak.kt") + public void testForInListIndicesBreak() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesBreak.kt"); + } + + @TestMetadata("forInListIndicesContinue.kt") + public void testForInListIndicesContinue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/forInIndices/forInListIndicesContinue.kt"); + } + @TestMetadata("forInNonOptimizedIndices.kt") public void testForInNonOptimizedIndices() throws Exception { runTest("compiler/testData/codegen/box/ranges/forInIndices/forInNonOptimizedIndices.kt");