mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
42 lines
758 B
Kotlin
42 lines
758 B
Kotlin
import kotlin.platform.platformStatic
|
|
|
|
object A {
|
|
|
|
val b: String = "OK"
|
|
|
|
platformStatic val c: String = "OK"
|
|
|
|
platformStatic fun test1() : String {
|
|
return b
|
|
}
|
|
|
|
platformStatic fun test2() : String {
|
|
return test1()
|
|
}
|
|
|
|
fun test3(): String {
|
|
return "1".test5()
|
|
}
|
|
|
|
platformStatic fun test4(): String {
|
|
return "1".test5()
|
|
}
|
|
|
|
platformStatic fun String.test5() : String {
|
|
return this + b
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
if (A.(A::test1)() != "OK") return "fail 1"
|
|
|
|
if (A.(A::test2)() != "OK") return "fail 2"
|
|
|
|
if (A.(A::test3)() != "1OK") return "fail 3"
|
|
|
|
if (A.(A::test4)() != "1OK") return "fail 4"
|
|
|
|
if (((A::c).get(A)) != "OK") return "fail 5"
|
|
|
|
return "OK"
|
|
} |