Files
kotlin-fork/compiler/testData/codegen/box/builtinStubMethods/nonTrivialUpperBound.kt
T
Dmitry Petrov 6cb0e5151c KT-9377 Support is-checks for read-only collections
Intrinsics for is/as/as? with mutable Kotlin collections and related types.
2015-10-02 15:17:00 +03:00

14 lines
313 B
Kotlin
Vendored

class MyIterator<E : Number> : Iterator<E> {
override fun next() = null!!
override fun hasNext() = null!!
}
fun box(): String {
try {
(MyIterator<Int>() as java.util.Iterator<Number>).remove()
return "Fail"
} catch (e: UnsupportedOperationException) {
return "OK"
}
}