[ty] diagnostic on overridden comparison dunder methods on order=True dataclasses#22689
Merged
sharkdp merged 3 commits intoastral-sh:mainfrom Feb 4, 2026
Merged
[ty] diagnostic on overridden comparison dunder methods on order=True dataclasses#22689sharkdp merged 3 commits intoastral-sh:mainfrom
order=True dataclasses#22689sharkdp merged 3 commits intoastral-sh:mainfrom
Conversation
Typing conformance resultsNo changes detected ✅ |
thejchap
commented
Jan 18, 2026
| literal.node(db, context.file(), context.module()), | ||
| ) { | ||
| let mut diagnostic = builder.into_diagnostic(format_args!( | ||
| "Cannot overwrite attribute `{}` in class `{}`", |
Contributor
Author
There was a problem hiding this comment.
the diagnostic emitted by mypy is:
main.py:9: error: You may not have a custom "__ge__" method when "order" is True [misc]which is different from what it emits for overridden __setattr__ | __delattr__. this pr just uses the same message that we emit for __setattr__ | __delattr__ - open to feedback here
Contributor
There was a problem hiding this comment.
Thanks! I updated the error messages to hopefully make them slightly more clear.
|
MichaReiser
reviewed
Jan 19, 2026
306daf0 to
de5f963
Compare
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
astral-sh/ty#111
emit a diagnostic on dataclasses that have custom comparison dunder methods defined that override the ones generated by
order=TrueTest Plan
new + existing mdtests