We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc3ba13 commit 2a31576Copy full SHA for 2a31576
crates/red_knot_python_semantic/resources/mdtest/dataclasses.md
@@ -173,6 +173,19 @@ GenericWithOrder[int](1) < GenericWithOrder[int](1)
173
GenericWithOrder[int](1) < GenericWithOrder[str]("a") # error: [unsupported-operator]
174
```
175
176
+If a class already defines one of the comparison methods, a `TypeError` is raised at runtime.
177
+Ideally, we would emit a diagnostic in that case:
178
+
179
+```py
180
+@dataclass(order=True)
181
+class AlreadyHasCustomDunderLt:
182
+ x: int
183
184
+ # TODO: Ideally, we would emit a diagnostic here
185
+ def __lt__(self, other: object) -> bool:
186
+ return False
187
+```
188
189
### `unsafe_hash`
190
191
To do
0 commit comments