Compiler extensions and typealias


I understand from documentation that Type aliases are pure syntactic sugar, and are not available at runtime.

However, I’m curious if it’s possible, by authoring a complier extension, to decorate usages with annotations.

For example:

typealias FirstName = String

fun doSomething(firstName: FirstName)

Then, at runtime, this would become visible as:

void doSomething(@FpmlType("") String firstName)

So, the goal of the compiler extension would be to add the annotation wherever the typealias is used as a parameter.

Are the appropriate transpilation / generation hooks available within the compiler extension framework to see that a typealias was declared as a parameter, and to add the annotation?


There is no “compiler extension framework”. There are specific extension points that we created to allow writing the few existing extensions that we needed to build, but there is no framework intended to be used by external developers.