[FIR] Add synthetic else branch to when if it's missing to LightTreeFirBuilder
This commit is contained in:
+5
@@ -497,6 +497,7 @@ class ExpressionsConverter(
|
||||
if (hasSubject) {
|
||||
subject.bind(this)
|
||||
}
|
||||
var thereIsElse = false
|
||||
for (entry in whenEntries) {
|
||||
val branch = entry.firBlock
|
||||
branches += if (!entry.isElse) {
|
||||
@@ -508,11 +509,15 @@ class ExpressionsConverter(
|
||||
FirWhenBranchImpl(null, firCondition, branch)
|
||||
}
|
||||
} else {
|
||||
thereIsElse = true
|
||||
FirWhenBranchImpl(
|
||||
null, FirElseIfTrueCondition(null), branch
|
||||
)
|
||||
}
|
||||
}
|
||||
if (!thereIsElse) {
|
||||
branches += FirWhenBranchImpl(null, FirElseIfTrueCondition(null), FirEmptyExpressionBlock())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user