Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForIfAsLastExpressionInLambda.fir.kt
T
Denis.Zharkov 00821bbc63 FIR: Update test data (repeated diagnostics)
They are a bit redundant, but it needs additional work to be done
to avoid them
2021-05-20 17:24:33 +03:00

43 lines
653 B
Kotlin
Vendored

// !LANGUAGE: +NewInference
class Obj
fun foo(): String? {
run {
if (true) return@run
if (true) Obj()
}
run {
if (true) return@run
if (true) return <!RETURN_TYPE_MISMATCH, TYPE_MISMATCH!>Obj()<!> // correct error, type check against return type of function "foo"
}
run {
if (true)
return@run
else
if (true) 42
}
run {
if (true)
42
else
if (true) 42
}
run {
if (true) return@run
if (true) {
Obj()
} else
if (true) return null
}
return ""
}