Files
kotlin-fork/compiler/testData/codegen/box/builtinStubMethods/nonTrivialUpperBound.kt
T
2019-11-19 11:00:09 +03:00

17 lines
367 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
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"
}
}