Do not cache "last" value (i.e., size/length) in lowered for-loop
iteration over CharSequences. CharSequences may be mutable (e.g., StringBuilder) and therefore its contents and length can change within the loop.
This commit is contained in:
committed by
max-kammerer
parent
3da3e1cae9
commit
c16b59191b
Generated
+10
@@ -14639,6 +14639,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCharSequenceLengthDecreasedInLoopBody.kt")
|
||||
public void testForInCharSequenceLengthDecreasedInLoopBody() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInCharSequenceLengthDecreasedInLoopBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCharSequenceLengthIncreasedInLoopBody.kt")
|
||||
public void testForInCharSequenceLengthIncreasedInLoopBody() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInCharSequenceLengthIncreasedInLoopBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||
|
||||
+10
@@ -15794,6 +15794,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/forByteProgressionWithIntIncrement.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCharSequenceLengthDecreasedInLoopBody.kt")
|
||||
public void testForInCharSequenceLengthDecreasedInLoopBody() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInCharSequenceLengthDecreasedInLoopBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCharSequenceLengthIncreasedInLoopBody.kt")
|
||||
public void testForInCharSequenceLengthIncreasedInLoopBody() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInCharSequenceLengthIncreasedInLoopBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt")
|
||||
public void testForInRangeLiteralWithMixedTypeBounds() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");
|
||||
|
||||
Reference in New Issue
Block a user