Don't use 'iinc' instruction on byte/short/char variables

Android run-time verifier complains when there's any possibility that a
byte/short/char local variable could contain a value not fitting into the
type's limits.
This commit is contained in:
Alexander Udalov
2013-06-25 18:11:17 +04:00
parent db41329e67
commit 356c32893b
5 changed files with 112 additions and 82 deletions
@@ -0,0 +1,22 @@
fun byteArg(b: Byte) {}
fun charArg(c: Char) {}
fun shortArg(s: Short) {}
fun box(): String {
var b = 42.toByte()
b++
++b
byteArg(b)
var c = 'x'
c++
++c
charArg(c)
var s = 239.toShort()
s++
++s
shortArg(s)
return "OK"
}