I've been drooling over the new Fir plugin api and...
# compiler
r
I've been drooling over the new Fir plugin api and had a few questions: 1. Will it make it into 1.4? In particular
FirDeclarationGenerationExtension
and the others that didn't make it into the RC 2. Is defining method/class bodies allowed in those methods? I.e. can I define a method body in
FirDeclarationGenerationExtension.generateMembers
? The AllOpen examples don't, and
generateMembersForGeneratedClass
is a thing instead of just adding members to the class. 3. Will using the Fir extensions replace
SyntheticResolveExtension
with regards to having added definitions show up in the IDE (it sure looks like it)?
r
1, 2 - cc @dmitriy.novozhilov 3 - Yes, that is a plan afaik
d
Hi @rnett. Fir extensions which you mention in first two questions are part of prototype of compiler API for new compiler frontend (FIR). Those extensions, as a Fir itself, are not ready for using and they won't for long time So, answering first question, those extensions won't we 1.4 (actually they will, but you can not use them).
About second question: main idea that you shouldn't generate declaration body for frontend declarations. Bodies should be generated for IR declarations which are created from FIR decelerations
r
Ok, thanks, that makes sense. Is FIR "not ready for using" like IR is currently (you can use it but stuff will break), or will it not work at all?
d
It almost (for ~99.999%) works on "green" code and for 92% correctly supports conversion ftom FIR to backend IR, so if you have correct project there is a big possibility that compiler with FIR can compile your code
But there are many things which are not implemented in FIR yet: - a lot of compiler checks for warnings/errors - MPP - properly tested compiler API - IDE plugin which working with FIR - something what i forgot
You can try FIR with
-Xuse-fir
flag of you want. Note that it's better try it on nightly compiler builds, not release ones (because FIR state in release branches is outdated)
You can download artifacts manually from buildserver to your mavenLocal Builds here are triggered by every push in master of kotlin repo https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Aggregate?mode=builds
As I know there is a way to setup teamcity as gradle repo, but I don't know exactly how