Files
kotlin-fork/compiler/testData/ir/irText/expressions/forWithImplicitReceivers.kt
T
2023-03-22 15:18:17 +00:00

20 lines
361 B
Kotlin
Vendored

// WITH_STDLIB
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
object FiveTimes
class IntCell(var value: Int)
interface IReceiver {
operator fun FiveTimes.iterator() = IntCell(5)
operator fun IntCell.hasNext() = value > 0
operator fun IntCell.next() = value--
}
fun IReceiver.test() {
for (i in FiveTimes) {
println(i)
}
}