For with Int#downto, Int#upto do not iterate on empty ranges.

This commit is contained in:
Pavel V. Talanov
2012-07-20 12:42:07 +04:00
parent 8eb0fb31ca
commit 0b4499a4b7
2 changed files with 17 additions and 0 deletions
@@ -52,4 +52,8 @@ public final class RangeTest extends SingleFileTranslationTest {
public void testIntDownTo() throws Exception {
fooBoxTest();
}
public void testUpToDownToDoNotIterate() throws Exception {
fooBoxTest();
}
}
@@ -0,0 +1,13 @@
package foo
import java.util.ArrayList
fun box() : Boolean {
for (i in 0 upto -1) {
return false
}
for (i in 0 downto 1) {
return false
}
return true
}