oook ```val x = fun(arg: String) { println(arg) }...
# reflect
g
oook
Copy code
val x = fun(arg: String) { println(arg) }

val functionRef: KFunction<*> = x::invoke //valid, i can create a reflective handle to invoke.

x::class.members // 6 entries, 2 each of equals, hashcode, tostring. invoke is missing
is this expected behaviour?
the function types are special and not like regular Kotlin classes, so the fact that reflection works at all is (somewhat) new
in this case you can see that
Copy code
x::class.supertypes // [kotlin.Any]
is empty, which is definitely wrong if you compare it to
Copy code
listOf(x::class.java.superclass) + x::class.java.interfaces // [class java.lang.Object, interface kotlin.jvm.functions.Function1]
so missing
invoke
probably stems from that
there is an experimental
Copy code
x.reflect()
for which
x.reflect()!!::class.members
will contain the correct
invoke
(and also many incorrect `invoke`s)