Files
kotlin/compiler/testData/codegen/bytecodeText/whenEnumOptimization/subjectAny.kt
Denis Zharkov 5a1c995b5c When by enum:
Generate TABLESWITCH/LOOKUPSWITCH bytecode command in case of "when" by enum entries
2014-07-21 17:13:55 +04:00

19 lines
287 B
Kotlin

enum class Season {
WINTER
SPRING
SUMMER
AUTUMN
}
fun foo(x : Any) : String {
return when (x) {
Season.WINTER -> "winter"
Season.SPRING -> "spring"
Season.SUMMER -> "summer"
else -> "other"
}
}
// 0 TABLESWITCH
// 0 LOOKUPSWITCH