Add KFunction.name, support reflection for function references

#KT-7694 Fixed
This commit is contained in:
Alexander Udalov
2015-06-17 20:37:57 +03:00
parent ab297a4da0
commit 3549e1e035
16 changed files with 302 additions and 54 deletions
@@ -0,0 +1,5 @@
fun box(): String {
fun OK() {}
return ::OK.name
}
@@ -0,0 +1,6 @@
import kotlin.platform.platformName
@platformName("Fail")
fun OK() {}
fun box() = ::OK.name
@@ -0,0 +1,16 @@
import kotlin.test.assertEquals
fun foo() {}
class A {
fun bar() = ""
}
fun Int.baz() = this
fun box(): String {
assertEquals("foo", ::foo.name)
assertEquals("bar", A::bar.name)
assertEquals("baz", Int::baz.name)
return "OK"
}