[JS_IR] Enable RangeContainsLowering optimizations.

This commit is contained in:
Mark Punzalan
2020-09-03 00:49:14 -07:00
committed by Roman
parent 88755a8d20
commit 16ab11289c
11 changed files with 105 additions and 137 deletions
+8 -12
View File
@@ -1,23 +1,19 @@
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// WITH_RUNTIME
import kotlin.test.*
fun box(): String {
for (x in 1..10) {
assert(x in 1..10)
assert(x + 10 !in 1..10)
assertTrue(x in 1..10)
assertTrue(x + 10 !in 1..10)
}
var x = 0
assert(0 !in 1..2)
assertTrue(0 !in 1..2)
assert(++x in 1..1)
assert(++x !in 1..1)
assertTrue(++x in 1..1)
assertTrue(++x !in 1..1)
assert(sideEffect(x) in 2..3)
assertTrue(sideEffect(x) in 2..3)
return "OK"
}
@@ -25,6 +21,6 @@ fun box(): String {
var invocationCounter = 0
fun sideEffect(x: Int): Int {
++invocationCounter
assert(invocationCounter == 1)
assertTrue(invocationCounter == 1)
return x
}