Fir2Ir: generate coercion to Unit for when branches if needed
Before this change, it could happen that `when` of type Unit has a branch whose type is not Unit. This can lead to problems in IR lowerings, for example PolymorphicSignatureLowering which is very reliant on the correct types of expressions and placement of coercions to Unit (KT-59218).
This commit is contained in:
committed by
Space Team
parent
5513740659
commit
79fa2b6db0
@@ -24,7 +24,7 @@ fun testEmptyBranches2(flag: Boolean) {
|
||||
else -> true
|
||||
} /*~> Unit */
|
||||
when {
|
||||
flag -> true
|
||||
flag -> true /*~> Unit */
|
||||
else -> { // BLOCK
|
||||
}
|
||||
}
|
||||
@@ -37,3 +37,4 @@ fun testEmptyBranches3(flag: Boolean) {
|
||||
else -> true
|
||||
} /*~> Unit */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user