Add tests on callable references
Object members and accessors for private class members
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user