[WIP] Add range-based scopes for captured items #8828
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The compiler uses ranges when capturing various info during a file type check. These ranges and/or end positions are then used to filter/lookup the infos at particular locations. An example feature using ranges is code completion where FCS looks for expressions types before a
.
and filters the previously captured expression types based on the expression end position.This PR introduces range-based scopes that group items in a range and allow to skip the whole scopes when they don't contain the requested range. The scopes are currently used for captured expression types only and it would be great to extend it to other captured items in future PRs.
The scopes can also be used for working with scoped items in parallel which can be an interesting way for future optimizations.
At the moment of PR creation not many scopes are created, namely there are scopes for top level module member declarations in implementation files. Ideally there should be separate scopes for each type, type member, and top level binding which is probably going to be coarse- and even-enough for most features.
This is a prototype and I expect things to change. I'm opening the PR since I'm looking for feedback and/or suggestions of better names or places for the things. I'm also interested to see if there are any failing tests with the change.