Is there a way in kapt to get a hold of the struct...
# kapt
r
Is there a way in kapt to get a hold of the structure of a function literal with receiver? When I try to extract info from
TypeElement
or the Kotlin Metadata library by @Eugenio for a function of the shape:
A.() -> B
it always shows up as
Function1<A, B>
but I have not found a place or API that denotes the declaration of such function as being the type of a receiver function.
e
I think there's something like
Protobuf.Function.receiverType
if I remember correctly 🤔
r
The issue is that the type does not represent a Function but the type of an argument of a function, so the only thing I have access there to is the
me.eugeniomarletti.kotlin.metadata.shadow.metadata.ProtoBuf.Function#getValueParameterList
which gives me a
me.eugeniomarletti.kotlin.metadata.shadow.metadata.ProtoBuf.ValueParameter#getType
when I query that
type
I see no useful info to determine the type is referring to a literal receiver function of the shape
A.() -> B
e
oh, right, try searching for the
kotlin.ExtensionFunctionType
annotation in `Protobuf.Type.jvmTypeAnnotation`: it's a marker annotation that denotes function types with a receiver 😉
r
Awesome, thanks!