Fix const range bounds generation

This commit is contained in:
Dmitry Petrov
2017-09-25 11:51:47 +03:00
parent e82544ffb0
commit 8f9ea3e08b
7 changed files with 77 additions and 3 deletions
@@ -0,0 +1,39 @@
fun test1(): Long {
var s = 0L
for (i in 1L..4) {
s = s * 10 + i
}
return s
}
fun test2(): Long {
var s = 0L
for (i in 1L..4.toShort()) {
s = s * 10 + i
}
return s
}
fun testLI(a: Long, b: Int): Long {
var s = 0L
for (i in a..b) {
s = s * 10 + i
}
return s
}
fun testLS(a: Long, b: Short): Long {
var s = 0L
for (i in a..b) {
s = s * 10 + i
}
return s
}
fun box(): String {
if (test1() != 1234L) return "Fail 1"
if (test2() != 1234L) return "Fail 1"
if (testLI(1L, 4) != 1234L) return "Fail 2"
if (testLS(1L, 4.toShort()) != 1234L) return "Fail 2"
return "OK"
}