Optimize range operations for 'until' extension from stdlib (KT-9900)

NB: for-in-until loop is generated as precondition loop, because the
corresponding range is right-exclusive (and thus we have no problems
with integer overflows).
This commit is contained in:
Dmitry Petrov
2017-05-02 15:00:14 +03:00
parent b83620fdb9
commit 506941e7e0
27 changed files with 533 additions and 8 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
fun Int.until(other: Int) = this..other - 1
fun foo() {
for (i in 1 until 2) {
val range = 1 until 2
for (i in range) {
}
for (i in 1..2 step 4) {}