Intrinsics for 'reversed': until

This commit is contained in:
Dmitry Petrov
2017-12-12 14:21:17 +03:00
parent 5f7460a8c7
commit 54cceac99b
9 changed files with 122 additions and 1 deletions
@@ -0,0 +1,15 @@
// WITH_RUNTIME
const val M = Int.MIN_VALUE
fun box(): String {
var count = 0
for (i in (M until M + 1).reversed()) {
++count
if (count > 1) {
throw AssertionError("Loop should be executed once")
}
}
if (count != 1) throw AssertionError("Should be executed once")
return "OK"
}