// !LANGUAGE: +NewInference // WITH_RUNTIME inline fun foo(f: () -> T): String { return (f() as? Inv)?.result() ?: "Bad" } class Inv { fun result(): String = "OK" } fun create(): Inv = Inv() fun test(b: Boolean): String { return foo { if (!b) { return@foo create() } if (b) { create() } else { null } } } fun box(): String { return test(true) }