David Peter
fcdffe4ac9
[ty] Pass down specialization to generic dataclass bases ( #19472 )
...
## Summary
closes https://github.com/astral-sh/ty/issues/853
## Test Plan
Regression test
2025-07-21 20:51:58 +02:00
David Peter
b6579eaf04
[ty] Disallow assignment to `Final` class attributes ( #19457 )
...
## Summary
Emit errors for the following assignments:
```py
class C:
CLASS_LEVEL_CONSTANT: Final[int] = 1
C.CLASS_LEVEL_CONSTANT = 2
C().CLASS_LEVEL_CONSTANT = 2
```
## Test Plan
Updated and new MD tests
2025-07-21 14:27:56 +02:00
justin
39b41838f3
[ty] synthesize __setattr__ for frozen dataclasses ( #19307 )
...
## Summary
Synthesize a `__setattr__` method with a return type of `Never` for
frozen dataclasses.
https://docs.python.org/3/library/dataclasses.html#frozen-instances
https://docs.python.org/3/library/dataclasses.html#dataclasses.FrozenInstanceError
### Related
https://github.com/astral-sh/ty/issues/111
https://github.com/astral-sh/ruff/pull/17974#discussion_r2108527106
https://github.com/astral-sh/ruff/pull/18347#discussion_r2128174665
## Test Plan
New Markdown tests
---------
Co-authored-by: David Peter <mail@david-peter.de>
2025-07-18 11:35:05 +02:00
David Peter
ce2bdb9357
[ty] Conditionally defined dataclass fields ( #19197 )
...
## Summary
Fixes a bug where conditionally defined dataclass fields were previously
ignored.
Thanks to @lipefree for reporting this.
## Test Plan
New Markdown tests
2025-07-08 16:16:50 +02:00
David Peter
9a4b85d845
[ty] Add tests for dataclass fields annotated with `Final` ( #19202 )
...
## Summary
Adds some tests for dataclass fields that are annotated with `Final`
(see comment
[here](https://github.com/astral-sh/ruff/pull/15768#issuecomment-3044737645 )).
Turns out that nothing is needed here, everything already works as
expected (apart from the fact that we can assign to `Final` fields,
which is tracked in https://github.com/astral-sh/ty/issues/158
## Test Plan
New Markdown tests
2025-07-08 12:33:46 +00:00
David Peter
e212dc2e8e
[ty] Restructure/move dataclass tests ( #19117 )
...
Before I'm adding even more dataclass-related files, let's organize them
in a separate folder.
2025-07-03 10:36:14 +00:00