-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Implement hierarchical trait map and namespace lookups. #6516
Implement hierarchical trait map and namespace lookups. #6516
Conversation
60db3a9
to
486df45
Compare
CodSpeed Performance ReportMerging #6516 will not alter performanceComparing Summary
|
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.
Overall it looks good, but I think there's a common pattern that can be abstracted out, and there's a nagging feeling at the back of my mind that you've introduced a shadowing issue. Let me know what you think - I might just be overthinking things.
sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs
Outdated
Show resolved
Hide resolved
c8f6cb0
to
4003178
Compare
Addressed all the review feedback, now walking of scope chains is abstracted into an helper. |
4003178
to
e7476b6
Compare
e7476b6
to
e18803c
Compare
Description
This PR implements a hierarchical-based trait map and namespace lookup system while type checking.
Previously we added the concept of lexical concepts, which store all the names in a tree-based hierarchy.
But currently we still rely on a single "global" namespace, which is maintained by the type check context as we go down the tree. Thus, so far, all trait and namespace lookup have relied on looking up in that single namespace.
The main idea here is to be able to just rely on the names existing in the lexical scopes, and walk up those lexical scope chains as we need to lookup any name or trait.
The logic is split into these two commits:
Implement hierarchical trait map lookups.
Implement hierarchical namespace lookups.
This PR still does not remove that cloning, which will be done in a separate future PR.
Checklist
Breaking*
orNew Feature
labels where relevant.