-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: More path resolution improvements #18823
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
Conversation
b6c3a1b
to
496f485
Compare
|
||
/** Holds if this `impl` block declares an associated item named `name`. */ | ||
pragma[nomagic] | ||
predicate declares(string name) { |
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.
I think a name like hasAssocItem
would be more immediately understandable.
this = | ||
any(TypeParamItemNode param | | ||
result = param.resolveABound().getASuccessorRec(name) and | ||
result instanceof AssocItemNode | ||
) |
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 = | |
any(TypeParamItemNode param | | |
result = param.resolveABound().getASuccessorRec(name) and | |
result instanceof AssocItemNode | |
) | |
result = this.(TypeParamItemNode).resolveABound().getASuccessorRec(name).(AssocItemNode) |
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.
Do we need to worry about lifetime bounds on type parameters? Filter them out?
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.
Lifetime type parameters are not part of ItemNode
, so I don't think any filtering is needed.
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.
Looks great. There certainly are a lot of different cases to handle.
this = | ||
any(TypeParamItemNode param | | ||
result = param.resolveABound().getASuccessorRec(name) and | ||
result instanceof AssocItemNode | ||
) |
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.
Do we need to worry about lifetime bounds on type parameters? Filter them out?
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 🎉
Add support for resolving trait items with default implementations, and items defined in type parameter bounds.