Files
kotlin-fork/compiler/testData/codegen/box/inference/kt42042.kt
T
Victor Petukhov c3a5a7754d Use proper applicability for constraint warnings
^KT-47316 Fixed
2021-07-09 14:07:01 +03:00

14 lines
314 B
Kotlin
Vendored

sealed class Subtype<A1, B1> {
abstract fun cast(value: A1): B1
class Trivial<A2 : B2, B2> : Subtype<A2, B2>() {
override fun cast(value: A2): B2 = value
}
}
fun <A, B> unsafeCast(value: A): B {
val proof: Subtype<A, B> = Subtype.Trivial()
return proof.cast(value)
}
fun box() = "OK"