// !LANGUAGE: -ProperTypeInferenceConstraintsProcessing sealed class Subtype { abstract fun cast(value: A1): B1 class Trivial : Subtype() { override fun cast(value: A2): B2 = value } } fun unsafeCast(value: A): B { val proof: Subtype = Subtype.Trivial() return proof.cast(value) } fun box() = "OK"