Fix loop over a range literal up to MAX_VALUE

#KT-492 In Progress

For Byte, Char and Short explicit casting from Int is removed -- loop parameter
is already stored in an Int anyway. For Int and Long comparison "i < end" at
the beginning of the loop is replaced to "i != end" at the end of the loop + a
special check for an empty loop
This commit is contained in:
Alexander Udalov
2013-06-17 21:47:41 +04:00
parent f1a6d27d35
commit 33d6347876
10 changed files with 561 additions and 31 deletions
@@ -439,6 +439,21 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/expression/infiniteSteps.kt");
}
@TestMetadata("maxValueMinusTwoToMaxValue.kt")
public void testMaxValueMinusTwoToMaxValue() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/expression/maxValueMinusTwoToMaxValue.kt");
}
@TestMetadata("maxValueToMaxValue.kt")
public void testMaxValueToMaxValue() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/expression/maxValueToMaxValue.kt");
}
@TestMetadata("maxValueToMinValue.kt")
public void testMaxValueToMinValue() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/expression/maxValueToMinValue.kt");
}
@TestMetadata("nanEnds.kt")
public void testNanEnds() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/expression/nanEnds.kt");
@@ -542,6 +557,21 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/literal/infiniteSteps.kt");
}
@TestMetadata("maxValueMinusTwoToMaxValue.kt")
public void testMaxValueMinusTwoToMaxValue() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/literal/maxValueMinusTwoToMaxValue.kt");
}
@TestMetadata("maxValueToMaxValue.kt")
public void testMaxValueToMaxValue() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/literal/maxValueToMaxValue.kt");
}
@TestMetadata("maxValueToMinValue.kt")
public void testMaxValueToMinValue() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/literal/maxValueToMinValue.kt");
}
@TestMetadata("nanEnds.kt")
public void testNanEnds() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/literal/nanEnds.kt");