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.
19 lines
310 B
Kotlin
Vendored
19 lines
310 B
Kotlin
Vendored
fun foo(x: Int): Int {
|
|
return when (x) {
|
|
1, 1, 2 -> 1001
|
|
1, 2 -> 1002
|
|
1 -> 1003
|
|
2 -> 1004
|
|
3 -> 1005
|
|
else -> 1006
|
|
}
|
|
}
|
|
|
|
// 1 SIPUSH 1001
|
|
// 0 SIPUSH 1002
|
|
// 0 SIPUSH 1003
|
|
// 0 SIPUSH 1004
|
|
// 1 SIPUSH 1005
|
|
// 1 SIPUSH 1006
|
|
// 1 TABLESWITCH
|
|
// 0 LOOKUPSWITCH |