Fix loops over progressions near to MAX_VALUE/MIN_VALUE

#KT-492 Fixed

For Byte, Char and Short ranges, promote the type of the loop parameter to int
to avoid overflows. For Int and Long ranges at the end of the loop over a
progression we now check if the new (incremented) value of the loop parameter
is greater than the old value iff increment > 0
This commit is contained in:
Alexander Udalov
2013-06-18 19:41:38 +04:00
parent 33d6347876
commit ee80e0b8ca
25 changed files with 1148 additions and 36 deletions
@@ -68,9 +68,13 @@ public class GenerateRangesCodegenTestData {
.put("Float.NaN", "Float")
.put("Double.NaN", "Double")
.put("MaxB", "Byte")
.put("MinB", "Byte")
.put("MaxS", "Short")
.put("MinS", "Short")
.put("MaxL", "Long")
.put("MinL", "Long")
.put("MaxC", "Char")
.put("MinC", "Char")
.build();
private static String detectElementType(String rangeExpression) {