Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/controlStructures/forLoopMemberExtensionAll.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

27 lines
367 B
Kotlin

class It {
}
class C {
}
class X {
var hasNext = true
operator fun It.hasNext() = if (hasNext) {hasNext = false; true} else false
operator fun It.next() = 5
operator fun C.iterator(): It = It()
fun test() {
for (i in C()) {
foo(i)
}
}
}
fun foo(x: Int) {}
fun box(): String {
X().test()
return "OK"
}