[FIR] Infer labeled type for lambda in return in catch ^KT-51009 Fixed

This commit is contained in:
Ivan Kochurkin
2022-01-28 22:56:38 +03:00
committed by teamcity
parent d82dff0e75
commit 30871fc08f
7 changed files with 51 additions and 1 deletions
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// ISSUE: KT-51009
fun test(b: Boolean, f: () -> String?): () -> String {
val foo = try {
f
} catch (e: Exception) {
return { "1" } // Infer return type of test () -> String instead of type of `f`
}
return { "2" }
}
fun test2(b: Boolean, f: () -> String?) = run { // implicit return type
val foo = try {
f
} catch (e: Exception) {
return { "1" }
}
{ "2" }
}
@@ -0,0 +1,5 @@
package
public fun test(/*0*/ b: kotlin.Boolean, /*1*/ f: () -> kotlin.String?): () -> kotlin.String
public fun test2(/*0*/ b: kotlin.Boolean, /*1*/ f: () -> kotlin.String?): () -> kotlin.String