Fix range-based 'for' loop with 'continue' in range bounds

1. Search for increment function in range element type, not in inferred
induction variable type
(which can be inappropriate, e.g., 'Nothing' in case of 'continue').

2. Handle nested loops with shared exit labels
(generated by JVM_IR for KT-37370 case).

KT-37370 KT-37373
This commit is contained in:
Dmitry Petrov
2020-03-16 11:40:35 +03:00
parent d5b65abc5d
commit 6809f4439c
14 changed files with 188 additions and 19 deletions
@@ -20467,6 +20467,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/ranges/forNullableIntInRangeWithImplicitReceiver.kt");
}
@TestMetadata("kt37370.kt")
public void testKt37370() throws Exception {
runTest("compiler/testData/codegen/box/ranges/kt37370.kt");
}
@TestMetadata("kt37370a.kt")
public void testKt37370a() throws Exception {
runTest("compiler/testData/codegen/box/ranges/kt37370a.kt");
}
@TestMetadata("multiAssignmentIterationOverIntRange.kt")
public void testMultiAssignmentIterationOverIntRange() throws Exception {
runTest("compiler/testData/codegen/box/ranges/multiAssignmentIterationOverIntRange.kt");