Files
kotlin-fork/compiler/testData/codegen/box/binaryOp/overflowChar.kt
T
2018-06-09 19:15:38 +03:00

11 lines
285 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
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"
}