b52f337f7f
Place valueOf() and values() into the static scope of the corresponding enum class #KT-5580 Fixed #KT-2410 Fixed
20 lines
447 B
Kotlin
20 lines
447 B
Kotlin
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"
|
|
}
|