Files
kotlin-fork/compiler/testData/codegen/box/when/enumOptimization/kt14597.kt
T
2017-01-24 15:17:47 +01:00

22 lines
388 B
Kotlin
Vendored
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
enum class En { A, B, С }
fun box(): String {
var res = ""
// nullable variable
val en2: Any? = En.A
if (en2 is En) {
when (en2) {
En.A -> {res += "O"}
En.B -> {}
En.С -> {}
}
when (en2 as En) {
En.A -> {res += "K"}
En.B -> {}
En.С -> {}
}
}
return res
}