For with Int#downto, Int#upto do not iterate on empty ranges.
This commit is contained in:
@@ -52,4 +52,8 @@ public final class RangeTest extends SingleFileTranslationTest {
|
|||||||
public void testIntDownTo() throws Exception {
|
public void testIntDownTo() throws Exception {
|
||||||
fooBoxTest();
|
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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user