KT-53255. Fix StackOverflow during IR verification from K2
In FIR we desugar when with multiple conditions leading to same block
as tree of OR expressions
Given
```
when(some) {
"a", "b", "c" -> {}
else -> {}
}
```
actually desugared into
```
when(val <subj> = some) {
<subj> == "a" || <subj> == "b" || <subj> == "c" -> {}
else -> {}
}
```
There is a multiple ways of how we can organize such expressions in FIR
Previously it was just nesting-chain of OR expressions
While the most efficient way in terms of required stack depth is
a balanced tree
KT-53255
This commit is contained in:
committed by
Space Team
parent
ac8cae16ba
commit
2cf8f75a90
@@ -1,5 +1,4 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
return when ("foo") {
|
||||
|
||||
Reference in New Issue
Block a user