Make enum classes comparable
#KT-3727 Fixed
This commit is contained in:
@@ -23,6 +23,7 @@ fun box(): String {
|
||||
|
||||
val ok2 = Simple.valueOf("OK")
|
||||
if (!ok2.equals(ok)) return "ok2 not equal ok"
|
||||
if (ok2.hashCode() != ok.hashCode()) return "hash(ok2) not equal hash(ok)"
|
||||
if (!ok2.identityEquals(ok)) return "ok2 not identity equal ok"
|
||||
|
||||
|
||||
@@ -33,6 +34,7 @@ fun box(): String {
|
||||
if (A.c.toString() != "c") return "A.c.toString() != c, it: ${A.c.toString()}"
|
||||
if (A.valueOf("b") != A.b) return "A.valueOf('b') != A.b"
|
||||
if (A.a == A.b) return "A.a == A.b"
|
||||
if (A.a.hashCode() == A.b.hashCode()) return "hash(A.a) == hash(A.b)"
|
||||
|
||||
if (A.a.name() != "a") return "A.a.name() != a, it: ${A.a.name()}"
|
||||
if (A.b.name() != "b") return "A.b.name() != b, it: ${A.b.name()}"
|
||||
|
||||
Reference in New Issue
Block a user