mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
Support platformStatic members in companion object of enums
#KT-7777 Fixed
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class Test {
|
||||
public static String foo() {
|
||||
return A.foo;
|
||||
}
|
||||
|
||||
public static String bar() {
|
||||
return A.bar;
|
||||
}
|
||||
|
||||
public static String getBar() {
|
||||
return A.getBar();
|
||||
}
|
||||
|
||||
public static String baz() {
|
||||
return A.baz();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
enum class A {
|
||||
companion object {
|
||||
val foo: String = "OK"
|
||||
|
||||
platformStatic val bar: String = "OK"
|
||||
|
||||
platformStatic fun baz() = foo
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (Test.foo() != "OK") return "Fail foo"
|
||||
if (Test.bar() != "OK") return "Fail bar"
|
||||
if (Test.getBar() != "OK") return "Fail getBar"
|
||||
if (Test.baz() != "OK") return "Fail baz"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user