Inherit context from source sites - #1383
Open
lionel- wants to merge 6 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Progress towards posit-dev/positron#14790
Progress towards #1338
Previously, only the
source()site would see sourced context (top-level bindings and transitive Source and Attach effects). With this PR, the sourced file now sees the context from the source site too.In a way, this is a more principled mechanism for the
R/auto-collation mechanism of the previous PR. In another way, this is a bit unprincipled, as standalone files are much easier to analyse, both by static analysis tools and by humans (https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md).When both the
R/auto-collation and the inherited source site apply, the latter wins: a resolvedsource()is a better signal than the directory-name convention. They should possibly union, since e.g. a Shiny-style autoload really does happen alongside. We can refine later.Now when you goto-def of
xinfoo.R, you'll see bothfile1.Randfile2.Rtargets. Note howyis conditionally undefined: this will need to be linted once we implement Oak-based symbol diagnostics.For now we have two new experimental diagnostics for effects ambiguity:
source-cycle, when files source each other:inherited-shadow, when an inherited binding changes what a callee resolves to:Positron Release Notes
New Features
source()location, allowing you to navigate to the inherited symbols or rename them.Bug Fixes