FIR: coerce to Unit when a lambda has early returns
^KT-39075 Fixed
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
83e3201677
commit
37a702b962
Vendored
+2
-2
@@ -11,7 +11,7 @@ FILE: coercionToUnitWithEarlyReturn.kt
|
||||
public final fun foo(x: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(x: R|A?|): R|kotlin/Unit| {
|
||||
lval lambda: R|() -> kotlin/Unit?| = l@fun <anonymous>(): R|kotlin/Unit?| {
|
||||
lval lambda: R|() -> kotlin/Unit| = l@fun <anonymous>(): R|kotlin/Unit| {
|
||||
when () {
|
||||
==(R|<local>/x|?.{ $subj$.R|kotlin/Any.hashCode|() }, Int(0)) -> {
|
||||
^@l Unit
|
||||
@@ -21,5 +21,5 @@ FILE: coercionToUnitWithEarlyReturn.kt
|
||||
^ R|<local>/x|?.{ $subj$.R|/A.unit|() }
|
||||
}
|
||||
|
||||
<Inapplicable(INAPPLICABLE): /foo>#(R|<local>/lambda|)
|
||||
R|/foo|(R|<local>/lambda|)
|
||||
}
|
||||
|
||||
+1
-2
@@ -14,6 +14,5 @@ fun main(x: A?) {
|
||||
x?.unit()
|
||||
}
|
||||
|
||||
// lambda has a type (() -> Unit?)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(lambda)<!>
|
||||
foo(lambda)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user