Files
kotlin-fork/compiler/testData/codegen/box/binaryOp/overflowInt.kt
T
Georgy Bronnikov 487f500f85 Revert "JVM_IR. Support compile time constants"
This reverts commit 055215c54f.
2018-09-25 05:24:48 +03:00

13 lines
352 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
fun box(): String {
val i1: Int = Int.MAX_VALUE
val i2 = i1 + 1
if (i2 > i1) return "fail: Int.MAX_VALUE + 1 should overflow to negative."
val i3: Int = Int.MIN_VALUE
val i4 = i3 - 1
if (i4 < i3) return "fail: Int.MIN_VALUE - 1 should overflow to positive."
return "OK"
}