JS: provide overflow behaviour for int binary operations (see KT-7733)

This commit is contained in:
Alexey Andreev
2016-09-19 15:13:28 +03:00
parent 24d5bdd62c
commit 446c4c0a33
11 changed files with 73 additions and 14 deletions
+21
View File
@@ -0,0 +1,21 @@
package foo
fun bigValue() = 0x7FFFFFFC
fun mediumValue() = 0x12345
fun box(): String {
var v = bigValue() + 1
if (v != 0x7FFFFFFD) return "fail1: $v"
v = bigValue() + 8
if (v != -0x7FFFFFFC) return "fail2: $v"
v = mediumValue() * 0x23456
if (v != -2112496338) return "fail3: $v"
v = bigValue() * bigValue()
if (v != 16) return "fail4: $v"
return "OK"
}