class Inv fun Inv<*>.invToInv(): Inv<*>? = null fun myRun(block: () -> R): R { return block() } fun test(c: Inv<*>) { myRun { if (true) return@myRun // coerction to Unit c.invToInv()?.let {} } } fun box(): String { test(Inv()) return "OK" }