-
Notifications
You must be signed in to change notification settings - Fork 564
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
Qualify locally-bound names with source spans #4293
Conversation
@purefunctor Just to clarify, is this a PR that has breaking changes that we may need to consider including in |
@JordanMartinez Yeah, this is breaking change for consumers of the compiler as a library. In particular, it changes the signature for the I'm just curious, have there been any instances where minor releases included breaking changes for the public-facing API of the compiler library? I'm fine with getting this potentially merged in after |
@purefunctor Gotcha. Thanks for clarifying.
AFAIK, the only consumers at this point are:
I'm not sure what our policy is for breaking changes that affect consumers of the library but not necessarily users of the language. |
Just wanted to say that changes are considered breaking if they affect "compiler-the-application" users, not "compiler-the-library" users. We need to document this more explicitly somewhere, but the short answer is this change isn't a breaking one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overall LGTM. The merge conflict and the source span comment needs to be resolved. Another question is whether we should try to merge another PR first to reduce merge conflicts.
If it's a breaking change to corefn that should be considered on its own
merits - currently using purescript as a library for corefn, so the details
don't matter. Have version dependency for other reasons anyway
…On Fri, 20 May 2022, 14:38 JordanMartinez, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/Language/PureScript/CoreFn/ToJSON.hs
<#4293 (comment)>
:
> + -- TODO: Should `sourceSpanXJSON` encode this information as well?
+ [ T.pack "spanName" .= toJSON (spanName ss)
@nwolverson <https://github.com/nwolverson> would this be something that
affects the purerl backend?
—
Reply to this email directly, view it on GitHub
<#4293 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVEPSY7A37TYIODRIOWBDDVK6IVVANCNFSM5TUDJEKA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I just synced back to |
Tests compile locally and aside from the comment about source span names, this should be ready for review. |
This PR is ready for review 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I had a few questions and small nitpicks before approving this.
Can't remember if I asked this before, but why a |
I can't remember exactly if it was intentional of me to use a
But yes, this is a valid concern that I'd missed and I could refactor the PR today to accommodate for that 🙂 |
This reverts commit 84b4821, as we refactored QualifiedBy to use SourcePos instead of SourceSpan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AST changes and the changes downstream of that all look good. Assuming there's a good reason I didn't understand for making a distinct pass for the renaming logic, just a few minor quibbles there; if there isn't a good reason, I'd prefer to see this integrated into the existing pass, since said pass duplicates a lot of the same ideas (keeping track of bound variables and updating them) and wouldn't require a new generic AST traversal to be defined.
Just a thought, but should we distinguish Also, on looking at this again, there's not a test that verifies that a given local binding has the expected |
e550df1
to
38dd240
Compare
@JordanMartinez We could, but it also means duplicating code that's already caught by
Maybe we could check through the CoreFn? I also mentioned before that any incorrectness in the renamer is likely going to be caught during type checking because |
Makes sense. Thanks for explaining! |
Description of the change
Closes #4287. This adds a new desugaring step,
desugarLocals
, which turns references to local bindings be qualified by the source spans of the said bindings they're referring back to. Note that this had to be a separate step fromdesugarImports
as it also needs to take into account binding groups. This also doesn't introduce new tests as an incorrect implementation breaks all other compiler tests quite heavily.Checklist:
[ ] Added myself to CONTRIBUTORS.md (if this is my first contribution)
[ ] Updated or added relevant documentation