FIR: use expected type for lambda return statements if possible

This commit is contained in:
pyos
2023-01-02 11:37:38 +01:00
committed by Dmitriy Novozhilov
parent 1eccb9aea1
commit 5e8591d61d
10 changed files with 60 additions and 17 deletions
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// !SKIP_TXT
interface Context<T> {
fun proceed(): T
}
interface A<T : Any, K : Any> {
fun process(block: Context<T>.(T) -> Unit)
}
fun <T> processNested(body: () -> T): T {
return body()
}
fun test(pipeline: A<Any, String>) {
pipeline.process {
// OK: processNested<Unit> { /* no return */ proceed() /*: Any */ /* implicit coercion to Unit */ }
return@process processNested { proceed() }
}
}