Any docs on Kotlin internals?


Hi all,

Do you have any documents dedicated to the Kotlin internals?
I’m interested in semantics analysis phase - in particular in type resolution and maintaining lexical scope.
As far as I can see you use PSI tree as semantics tree not only for your IDE plugin but for semantics analysis as well.

At first look it seems you prefer literate programming style over javadocs - that implies that the good code is self evident and does not require to be documented :slight_smile:

Could you please point me on how you debug the compiler parts that related to type resolution if you find issues with that? I’ve seen tests (does JetTypeCheckerTest is the one that I need?) but I’m not sure on where to start.

Thank you in advance!



No docs on the compiler inetrnals so far. Sorry about that.

PSI is teh parse tree, the semantic information is written to a BindingTrace, and later read through BindingContext.

There’s JetResolveTest for name resolution, JetTypeCheckerTest and the rest of that package for very basic type-checker functionality, and JetDiagnosticsTestGenerated for pretty much everything else.

Feel free to ask questions here.


I see. Thank you!