Commit Graph

3 Commits

Author SHA1 Message Date
Simon Ogorodnik 2cf8f75a90 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
2022-10-26 17:44:46 +00:00
Simon Ogorodnik ac8cae16ba KT-53255. Extend test for long when expression 2022-10-26 17:44:46 +00:00
Xin Wang ebcc2cc3b2 PSI2IR: KT-49485 chunk ktConditions to avoid stackoverflow 2022-01-24 19:28:59 +03:00