-
Notifications
You must be signed in to change notification settings - Fork 272
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
bugfix: make namespace directive not churn unique types #5509
Conversation
|
@@ -58,7 +58,7 @@ structural ability X where | |||
``` ucm :added-by-ucm | |||
Loading changes detected in scratch.u. | |||
|
|||
I found two types called X: |
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 change is due to the fact that our parser has two different error constructors that represent the duplicate type names. This PR performed only minimal unification (switching one over to the other), but there's a little bit more cleanup to do, namely delete the other one entirely.
@aryairani Out of expedience I decided to leave the |
I read over the code but I didn't get the new strategy. If you're convinced it will work, that's fine; if you want to discuss it let me know. |
@aryairani Yeah I'm confident it will work. When we query the parser environment for whether a unique type already exists for a particular name, we prefix the given name with the current namespace directive, if any. It's really that simple, I didn't think of this solution right away though. :( |
Overview
Fixes #5489
This PR tweaks decl parsing to delay assigning a unique type guid until after the namespace pragma is applied. Previously (as seen in first transcript commit), one could accidentally be assigned a new unique type guid in the presence of a namespace directive.
Test coverage
I've added a transcript that demonstrates the fix.