raulraja
07/04/2018, 3:01 PMextension
in grammar. (grammar/src/modifiers.grm) What are other relevant places that need to change for the grammar to be valid Kotlin syntax?
- Function/Class/Interface args scope resolution. Interested as to where it is decided which extension functions apply and what the this
and parent scopes refer to.
- Call scope resolution tests: What is an effective way to test my changes to resolution are correct or similar tests I can use as base for the type class definition and resolution tests?
In general I’m also interested if anyone has stories to tell as to how they go about adding a similar feature to the compiler, what is the flow usually looks like when working in this project. Ultimately if anyone wants to help please contact me, thanks!mikhail.zarechenskiy
07/04/2018, 3:30 PM- New modifierI believe it's easier to show similar changes in the compiler for other modifiers, please check out these changes https://github.com/JetBrains/kotlin/commit/6e2ef9b1d2d5834c69ca44567faac77dd5dad476 how to serialize/deserialize modifiers: https://github.com/JetBrains/kotlin/commit/db1f03958629794b6715663cdc8a743cb1500888in grammar. (grammar/src/modifiers.grm) What are other relevant places that need to change for the grammar to be valid Kotlin syntax?extension
raulraja
07/04/2018, 5:08 PMdsavvinov
07/04/2018, 5:49 PMAre there any docs as to how things are architected, organized etc?Unfortunately, no, there's no such docs at the moment
Function/Class/Interface args scope resolution. Interested as to where it is decided which extension functions apply and what theGenerally, you will need to understand two things: - how scopes structure is built: nice starting point for that isand parent scopes refer to.this
ClassResolutionScopesSupport
- how this scope structure is then used for names resolution. Entry point for that is NewResolutionOldInference.runResolution
, which will lead to large subsystem of resolution.
Call scope resolution tests: What is an effective way to test my changes to resolution are correct or similar tests I can use as base for the type class definition and resolution tests?There is
testData/diagnostics/resovle
tests: though that's not all about resolution, I think it's more than enough to begin with. You can use them for two things: a) sanity check that you haven't break existing semantics
b) as source of inspiration for your tests with typeclasses
As for optimal way to dig through sources: I think, step-debugging simple cases is, probably, the most efficient way to grasp what compiler does. Obviously, you'll need to know where to place first breakpoint (trying to step from the very beginning of compiler invocation is quite insane) -- I've already pointed to some crucial parts, but feel free to ask for additional help 🙂raulraja
07/05/2018, 10:01 AMtomasruizlopez
09/11/2018, 6:05 PMModifierMaskUtils
where it is stated that a 32bit Int is used to create a mask to represent keywords for modifiers. With our two new keywords with
and extension
, the number of keywords is 34, breaking this assertion. Could you let us know the implications of this?
ResolveTestGenerated
, which makes use of multiple .resolve
files, but unfortunately they don't run. When I try to run them, I get java.lang.RuntimeException: Could not find installation home path. Please reinstall the software.
, whereas when I try to run other tests, such as parsing ones in ParsingTestGenerated
, I can run them normally. Any hints about this?with(arg) { ... }
function.
I appreciate your help. Thanks in advance!tomasruizlopez
09/12/2018, 8:23 AMdsavvinov
09/20/2018, 7:39 AMwith(arg) { ... }
really a nice example in your case), put breakpoint in some relevant class (it's TowerResolver
in your case), step through it trying to understand what compiler does and why
- during this process, you'll inevitably stuck in some questions which you can't answer on your own -- then you come back and ask specific questions, like "what this piece of code does? Why it is necessary?". Needless to say, we'll be happy to answer those questions 🙂
Note that this is the main difference from "lecture-like" approach - we're explaining not some enormously large system in general, but it's specific parts (which will, of course, bring some general concepts too, but now they are tied to the practice and real code).
- at some point you'll think that you understand something - then you can go and actually change something and see if your understanding were correct
I recognize that maybe that wasn't the answer you were expecting (and I'm sorry for that), but we actually believe that it'll be better this way. Hope that helps!dsavvinov
09/20/2018, 7:50 AMtomasruizlopez
09/20/2018, 9:22 AM