Files
kotlin-fork/compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt
T
Alexander Udalov 1071919706 Remove backend tests on old inference
Also remove any mentions of NewInference, and rename some tests.
2021-11-09 20:07:33 +01:00

30 lines
452 B
Kotlin
Vendored

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