Ensure type of a stack value is coerced to the expected return type after the binary operation instruction with the different return type.

This commit is contained in:
Ilya Gorbunov
2015-07-11 16:09:22 +03:00
parent f7ccb3819e
commit 4ad6a8e301
6 changed files with 55 additions and 9 deletions
+10
View File
@@ -0,0 +1,10 @@
fun box(): String {
val c1: Char = 0.toChar()
val c2 = c1 - 1
if (c2 < c1) return "fail: 0.toChar() - 1 should overflow to positive."
val c3 = c2 + 1
if (c3 > c2) return "fail: FFFF.toChar() + 1 should overflow to zero."
return "OK"
}