Files
kotlin-fork/backend.native/tests/external/codegen/box/when/enumOptimization/functionLiteralInTopLevel.kt
T
2017-03-13 15:31:46 +03:00

18 lines
286 B
Kotlin

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"
}
}
}