Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate code analysis to FIR #22

Open
artem-zinnatullin opened this issue Jun 24, 2022 · 0 comments
Open

Migrate code analysis to FIR #22

artem-zinnatullin opened this issue Jun 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@artem-zinnatullin
Copy link
Contributor

After multiple discussions with JetBrains people, I was explained that Kotlin compiler is getting rearchitectured, in particular IR (intermediate representation) is getting split into Frontend IR (FIR) and Backend IR parts.

Currently, Ketolang hooks into IrGenerationExtension.

Ketolang code analysis should be moved to FIR when FIR is stabilized (currently in Alpha):

  • IntelliJ will be running FIR analysis via compiler and configured compiler plugins to validate code in IDE, which will automatically integrate Ketolang analysis into IntelliJ! (errors)
  • New IR architecture is faster than current IR — JB claims 4x improvement, since it doesn't rely on complete type inference nor complete code DOM tree being prepared in many cases nor global map of PSI symbols to parsed resolutions
  • FIR is the right place to analyze code and generate stubs of declarations, Backend IR is the right place to generate actual IR bodies

Ketolang code generation (if added) should be moved to Backend IR:

  • This way it won't slow down IntelliJ by generating code during code analysis, only FIR is going to be run in IntelliJ
  • Code generated in Backend IR or IrGenerationExtension is not available for IntelliJ within the same module, however FIR can generate declarations of the members while Backend IR can later inflate them with IR bodies.

See:

JB contact for this: Dmitry Novozhilov @demiurg906

@artem-zinnatullin artem-zinnatullin added the enhancement New feature or request label Jun 24, 2022
@artem-zinnatullin artem-zinnatullin self-assigned this Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant