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,12 @@
enum class <!CONFLICTING_JVM_DECLARATIONS, CONFLICTING_JVM_DECLARATIONS!>A<!> {
A1
A2
<!CONFLICTING_JVM_DECLARATIONS!>fun valueOf(s: String): A<!> = valueOf(s)
fun valueOf() = "OK"
<!CONFLICTING_JVM_DECLARATIONS!>fun values(): Array<A><!> = null!!
fun values(x: String) = x
}
@@ -0,0 +1,9 @@
enum class E {
ENTRY
class object {
fun entry() = ENTRY
}
}
fun bar() = E.entry()
@@ -0,0 +1,10 @@
enum class E {
ENTRY
private class object
}
fun foo() = E.values()
fun bar() = E.valueOf("ENTRY")
fun baz() = E.ENTRY
fun quux() = <!INVISIBLE_MEMBER!>E<!>
@@ -1,9 +0,0 @@
// FILE: 1.kt
package a
private enum class E { ENTRY }
// FILE: 2.kt
package b
val e = a.<!INVISIBLE_MEMBER!>E<!>
@@ -21,4 +21,4 @@ fun f1() = ENTRY
fun f2() = ANOTHER
fun f3() = Nested()
fun f4() = Nested.foo()
fun f5() = <!UNRESOLVED_REFERENCE!>values<!>()
fun f5() = values()
@@ -0,0 +1,11 @@
enum class E {
<!REDECLARATION!>FIRST<!>
<!REDECLARATION!>SECOND<!>
class object {
class <!REDECLARATION!>FIRST<!>
val <!REDECLARATION!>SECOND<!> = this
}
}