Files
kotlin/compiler/testData/codegen/functions/removeInIterator.kt
Svetlana Isakova 96d99d19f3 generates remove method
throwing exception
in Kotlin class extending Iterator
2012-08-16 18:39:24 +04:00

13 lines
382 B
Kotlin

fun box() : String {
try {
removeInIterator.bar(object : Iterator<Int> {
public override fun hasNext(): Boolean = false
public override fun next(): Int = 1
})
}
catch (e: UnsupportedOperationException) {
if (e.getMessage() == "Mutating method called on a Kotlin Iterator")
return "OK"
}
return "fail"
}