Drop enum class object hack

Place valueOf() and values() into the static scope of the corresponding enum
class

 #KT-5580 Fixed
 #KT-2410 Fixed
This commit is contained in:
Alexander Udalov
2014-09-05 13:39:33 +04:00
parent bb54825fac
commit b52f337f7f
43 changed files with 299 additions and 352 deletions
@@ -0,0 +1,19 @@
enum class Game {
ROCK
PAPER
SCISSORS
class object {
fun foo() = ROCK
val bar = PAPER
}
}
fun box(): String {
if (Game.foo() != Game.ROCK) return "Fail 1"
// TODO: fix initialization order and uncomment
// if (Game.bar != Game.PAPER) return "Fail 2: ${Game.bar}"
if (Game.values().size != 3) return "Fail 3"
if (Game.valueOf("SCISSORS") != Game.SCISSORS) return "Fail 4"
return "OK"
}