Support platformStatic for properties

#KT-5766 Fixed
This commit is contained in:
Michael Bogdanov
2014-11-14 15:48:45 +03:00
parent 5412a67d29
commit 2cc9d8e29b
24 changed files with 450 additions and 165 deletions
@@ -4,6 +4,8 @@ object A {
val b: String = "OK"
platformStatic val c: String = "OK"
platformStatic fun test1() : String {
return b
}
@@ -34,5 +36,7 @@ fun box(): String {
if (A.(A::test4)() != "1OK") return "fail 4"
if (((A::c).get(A)) != "OK") return "fail 5"
return "OK"
}
@@ -4,6 +4,8 @@ object A {
val b: String = "OK"
platformStatic val c: String = "OK"
platformStatic fun test1() : String {
return {b}()
}
@@ -23,6 +25,10 @@ object A {
platformStatic fun String.test5() : String {
return {this + b}()
}
fun test6(): String {
return {c}()
}
}
fun box(): String {
@@ -36,5 +42,7 @@ fun box(): String {
if (with(A) {"1".test5()} != "1OK") return "fail 5"
if (A.test6() != "OK") return "fail 6"
return "OK"
}
@@ -2,6 +2,8 @@ import kotlin.platform.platformStatic
object AX {
platformStatic val c: String = "OK"
platformStatic fun aStatic(): String {
return AX.b()
}
@@ -14,13 +16,19 @@ object AX {
return "OK"
}
fun getProperty(): String {
return AX.c
}
}
fun box() : String {
if (AX.aStatic() != "OK") return "fail 1"
if (AX.aNonStatic() != "OK") return "fail 1"
if (AX.aNonStatic() != "OK") return "fail 2"
if (AX.getProperty() != "OK") return "fail 3"
return "OK"
}
@@ -0,0 +1,11 @@
import kotlin.platform.platformStatic
object X {
platformStatic val x = "OK"
fun fn(value : String = x): String = value
}
fun box(): String {
return X.fn()
}
@@ -0,0 +1,31 @@
import kotlin.platform.platformStatic
object A {
platformStatic var a: Int = 1
var b: Int = 1
[platformStatic] get
var c: Int = 1
[platformStatic] set
}
fun box(): String {
if (A.test1() != "OK") return "fail 1"
if (A.test2() != "OK") return "fail 2"
if (A.test3() != "1OK") return "fail 3"
if (A.test4() != "1OK") return "fail 4"
if (with(A) {"1".test5()} != "1OK") return "fail 5"
if (A.c != "OK") return "fail 6"
return "OK"
}
@@ -4,6 +4,8 @@ object A {
val b: String = "OK"
platformStatic val c: String = "OK"
platformStatic fun test1() : String {
return b
}
@@ -36,5 +38,7 @@ fun box(): String {
if (with(A) {"1".test5()} != "1OK") return "fail 5"
if (A.c != "OK") return "fail 6"
return "OK"
}