[Raw FIR] Build if - else if - else as two nested whens
This is necessary for inference to work like in K1 because we only add equality constraints from expected types on top-level `when`, not on nested ones. #KT-65882
This commit is contained in:
committed by
Space Team
parent
888c1defa0
commit
b4413776ab
@@ -3,7 +3,15 @@ interface Promise<T>
|
||||
|
||||
fun <T> materializePromise(): Promise<T> = TODO()
|
||||
|
||||
fun foo(x: Int, p1: Promise<Any?>, p2: Promise<Nothing?>): Promise<*> {
|
||||
fun foo0(x: Int, p2: Promise<Nothing?>): Promise<*> {
|
||||
return if (x == 3) {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materializePromise<!>()
|
||||
} else {
|
||||
p2
|
||||
}
|
||||
}
|
||||
|
||||
fun foo1(x: Int, p1: Promise<Any?>, p2: Promise<Nothing?>): Promise<*> {
|
||||
return if (x == 0) {
|
||||
p1
|
||||
} else {
|
||||
@@ -15,10 +23,12 @@ fun foo(x: Int, p1: Promise<Any?>, p2: Promise<Nothing?>): Promise<*> {
|
||||
}
|
||||
}
|
||||
|
||||
fun foo2(x: Int, p2: Promise<Nothing?>): Promise<*> {
|
||||
return if (x == 3) {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materializePromise<!>()
|
||||
fun foo2(x: Int, p1: Promise<Any?>): Promise<*> {
|
||||
return if (x == 0) {
|
||||
p1
|
||||
} else if (x == 2) {
|
||||
materializePromise()
|
||||
} else {
|
||||
p2
|
||||
p1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user