https://kotlinlang.org logo
Title
k

K J

03/19/2023, 8:10 PM
Hi, I'm trying to create a synthetic property for a specific class - I just started learning the compiler a few hours ago! For now, I'm fine with it applying to all classes - I'm just trying to get it working! Right now, I created a
SyntheticResolveExtension
that seems to create a synthetic property named
test
that works on any
Any
and returns a
String
. However, compilation still fails because the property getter has no function body:
Caused by: java.lang.IllegalStateException: Function has no body: FUN name:<get-test> visibility:public modality:OPEN <testDescriptor> ($receiver:kotlin.Any) returnType:kotlin.String
Is the next step to add a function body to this property with an
IrElementVisitor
? Or is that wrong / is there a better method?