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:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user