Skip to content
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

Improve global name resolution #60

Merged
merged 3 commits into from
Mar 9, 2023
Merged

Improve global name resolution #60

merged 3 commits into from
Mar 9, 2023

Conversation

bamarsha
Copy link
Contributor

@bamarsha bamarsha commented Mar 9, 2023

This improves the shadowing rules when resolving globals to avoid ambiguous name errors when there is an intuitive choice. Generally, the rule is still that nearer definitions shadow farther definitions. This is true for local scopes, and I extended it to globals:

  • Items in the parent namespace shadow items in opened namespaces.
  • Items in an aliased namespace shadow unopened globals that happen to share the same path.

The only case where a name is ambiguous is when there is a choice between opened namespaces.

@bamarsha bamarsha requested review from idavis and swernli March 9, 2023 01:10
compiler/qsc_frontend/src/resolve.rs Outdated Show resolved Hide resolved
@bamarsha bamarsha merged commit 90a9196 into main Mar 9, 2023
@bamarsha bamarsha deleted the samarsha/better-globals branch March 9, 2023 03:19
@swernli swernli mentioned this pull request Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants