mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Move properties of enum class object to the enum class
Similar to how it's done for usual classes
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
String test() {
|
||||
String s;
|
||||
|
||||
s = Klass.NAME;
|
||||
if (!s.equals("Klass")) throw new AssertionError("Fail class: " + s);
|
||||
|
||||
s = Trait.NAME;
|
||||
if (!s.equals("Trait")) throw new AssertionError("Fail trait: " + s);
|
||||
|
||||
s = Enoom.NAME;
|
||||
if (!s.equals("Enoom")) throw new AssertionError("Fail enum: " + s);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
class Klass {
|
||||
class object {
|
||||
val NAME = "Klass"
|
||||
}
|
||||
}
|
||||
|
||||
trait Trait {
|
||||
class object {
|
||||
val NAME = "Trait"
|
||||
}
|
||||
}
|
||||
|
||||
enum class Enoom {
|
||||
class object {
|
||||
val NAME = "Enoom"
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = Test().test()
|
||||
Reference in New Issue
Block a user