Files
kotlin/compiler/testData/codegen/bytecodeText/whenEnumOptimization/functionLiteralInTopLevel.kt
2015-08-10 16:24:12 +03:00

22 lines
338 B
Kotlin
Vendored

import kotlin.test.assertEquals
enum class Season {
WINTER,
SPRING,
SUMMER,
AUTUMN
}
fun foo(x : Season, block : (Season) -> String) = block(x)
fun box() : String {
return foo(Season.SPRING) {
x -> when (x) {
Season.SPRING -> "OK"
else -> "fail"
}
}
}
// 1 LOOKUPSWITCH