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:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user