Add tests on callable references

Object members and accessors for private class members
This commit is contained in:
Alexander Udalov
2013-12-17 23:37:57 +04:00
parent 363fe607fc
commit 596b1622a3
4 changed files with 48 additions and 0 deletions
@@ -0,0 +1,13 @@
object A {
var result = "Fail"
fun foo() {
result = "OK"
}
}
fun box(): String {
val x = A::foo
A.x()
return A.result
}
@@ -0,0 +1,13 @@
object A {
var result = "Fail"
fun foo(newResult: String) {
result = newResult
}
}
fun box(): String {
val x = A::foo
A.x("OK")
return A.result
}
@@ -0,0 +1,7 @@
class A {
private fun foo() = "OK"
fun bar() = this.(::foo)()
}
fun box() = A().bar()