Fix for KT-14597: "When" over smartcasted enum is broken and breaks all other "when"

#KT-14597 Fixed
This commit is contained in:
Mikhael Bogdanov
2017-01-23 16:04:26 +01:00
parent ee9a174c1f
commit df8394bcd2
22 changed files with 443 additions and 8 deletions
@@ -0,0 +1,27 @@
private fun Any?.doTheThing(): String {
when (this) {
is String -> return this
is Level -> {
when (this) {
Level.O -> return Level.O.name
Level.K -> return Level.K.name
}
}
else -> return "fail"
}
}
enum class Level {
O,
K
}
fun box(): String {
return "O".doTheThing() + Level.K.doTheThing()
}
// 1 LOOKUPSWITCH