-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Improve a check for inheritance relationship between types during binary operator re-inference in nullable walker #80272
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
|
I find the PR title "Narrow conversion kinds considered when reinferring methods by nullable walker" not very specific, I might even say confusing:
The description also doesn't clearly describe the context for the change, in my opinion. Consider adjusting. At least the title |
AlekseyTs
left a comment
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.
Apart from title and description, LGTM (commit 1)
I think it does affect only binary operators though - the modified code is inside
I can update the title to say between derived/base types I guess. Thanks.
I'm not sure what you mean, can you elaborate? |
Ah, that's what you are saying. Sorry, I misread it. I will update the title. |
When re-inferring a binary operator in nullable walker, we previously replaced the original containing type with a new one if there was any implicit conversion between them, so e.g.
operator==(ROS, ROS)would be re-inferred as a member ofSpanbecause there is a conversion fromSpantoROS. But that doesn't mean the operator can be found onSpan! Instead we should only allow conversions that make sense so the operator can be actually found on the re-inferred parent, e.g., a derived relationship (implicit reference conversion).Fixes #80255.