Inherit KProperty interfaces from function types

To be able to write the following: listOfStrings.map(String::length)
This commit is contained in:
Alexander Udalov
2015-12-11 17:13:00 +03:00
parent f25f0db10e
commit dc84445e2e
14 changed files with 98 additions and 4 deletions
@@ -0,0 +1,31 @@
var state = ""
var topLevel: Int
get() {
state += "1"
return 42
}
set(value) {
throw AssertionError("Nooo")
}
class A {
val member: String
get() {
state += "2"
return "42"
}
}
val A.ext: Any
get() {
state += "3"
return this
}
fun box(): String {
(::topLevel)()
(A::member)(A())
(A::ext)(A())
return if (state == "123") "OK" else "Fail $state"
}