KT-2596 Can't use iterator in for-loop
#KT-2596 fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
val iterator: Iterator<Int> = (0..0).iterator()
|
||||
for (i in iterator) {
|
||||
return "OK"
|
||||
}
|
||||
return "fail"
|
||||
}
|
||||
@@ -373,4 +373,8 @@ public class StdlibTest extends CodegenTestCase {
|
||||
public void testKt2246() {
|
||||
blackBoxFile("regressions/kt2246.kt");
|
||||
}
|
||||
|
||||
public void testKt2596() {
|
||||
blackBoxFile("regressions/kt2596.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@ import java.util.Collection
|
||||
import java.util.HashSet
|
||||
import java.util.LinkedList
|
||||
|
||||
/**
|
||||
Helper to make jet.Iterator usable in for
|
||||
*/
|
||||
public inline fun <T> Iterator<T>.iterator() : Iterator<T> = this
|
||||
|
||||
/**
|
||||
Helper to make java.util.Iterator usable in for
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user