Fix for KT-12125: Wrong increment/decrement on Byte/Char/Short.MAX_VALUE/MIN_VALUE

#KT-12125 Fixed
This commit is contained in:
Mikhael Bogdanov
2016-05-10 15:49:22 +03:00
parent 8425304866
commit d6a64af929
8 changed files with 98 additions and 12 deletions
+17
View File
@@ -0,0 +1,17 @@
fun test(i: Int): Int {
return i
}
fun box(): String {
var b = Byte.MAX_VALUE
b++
var result = test(b.toInt())
if (result != Byte.MIN_VALUE.toInt()) return "fail 1: $result"
var s = Short.MIN_VALUE
s--
result = test(s.toInt())
if (result != Short.MAX_VALUE.toInt()) return "fail 2: $result"
return "OK"
}