05ff2b1292
FIR translates:
```
when (x) {
1, 2, 3 -> action
else -> other_action
}
```
to an IR structure with nested ors:
```
if ((x == 1 || x == 2) || (x == 3)) action
else other_action
```
This change allows that to turn into switch instructions in the
JVM backend.
27 lines
469 B
Kotlin
Vendored
27 lines
469 B
Kotlin
Vendored
enum class Season {
|
|
WINTER,
|
|
SPRING,
|
|
SUMMER,
|
|
AUTUMN
|
|
}
|
|
|
|
fun foo1(x : Season?) : String {
|
|
when(x) {
|
|
Season.AUTUMN, Season.SPRING -> return "autumn_or_spring";
|
|
Season.SUMMER, null -> return "summer_or_null"
|
|
}
|
|
|
|
return "other"
|
|
}
|
|
|
|
fun foo2(x : Season?) : String {
|
|
when(x) {
|
|
Season.AUTUMN, Season.SPRING -> return "autumn_or_spring";
|
|
Season.SUMMER -> return "summer"
|
|
}
|
|
|
|
return "other"
|
|
}
|
|
|
|
// 2 TABLESWITCH
|