[FIR] Infer labeled type for lambda in return in catch ^KT-51009 Fixed
This commit is contained in:
+20
@@ -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" }
|
||||
}
|
||||
+5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user