Generate for-in-range loop as counter loop when possible

If an upper bound is a compile-time constant != Int.MAX_VALUE,
we can generate 'for (i in x..N)' as 'for (i in x until N+1)'.
This commit is contained in:
Dmitry Petrov
2017-07-26 15:25:16 +03:00
parent 7450899b87
commit b867c46f72
9 changed files with 114 additions and 1 deletions
@@ -13322,6 +13322,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("forInRangeToConstWithOverflow.kt")
public void testForInRangeToConstWithOverflow() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInRangeToConstWithOverflow.kt");
doTest(fileName);
}
@TestMetadata("forInRangeWithImplicitReceiver.kt")
public void testForInRangeWithImplicitReceiver() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInRangeWithImplicitReceiver.kt");