Files
kotlin/compiler/testData/codegen/box/builtinStubMethods/Iterator.kt
2013-09-25 20:59:23 +04:00

13 lines
328 B
Kotlin

class MyIterator<T>(val v: T): Iterator<T> {
override fun next(): T = v
override fun hasNext(): Boolean = true
}
fun box(): String {
try {
(MyIterator<String>("") as MutableIterator<String>).remove()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
return "OK"
}
}