[red-knot] typing.dataclass_transform (#17445)

## Summary

* Add initial support for `typing.dataclass_transform`
* Support decorating a function decorator with `@dataclass_transform(…)`
(used by `attrs`, `strawberry`)
* Support decorating a metaclass with `@dataclass_transform(…)` (used by
`pydantic`, but doesn't work yet, because we don't seem to model
`__new__` calls correctly?)
* *No* support yet for decorating base classes with
`@dataclass_transform(…)`. I haven't figured out how this even supposed
to work. And haven't seen it being used.
* Add `strawberry` as an ecosystem project, as it makes heavy use of
`@dataclass_transform`

## Test Plan

New Markdown tests
This commit is contained in:
David Peter
2025-04-22 10:33:02 +02:00
committed by GitHub
parent f83295fe51
commit 37a0836bd2
12 changed files with 634 additions and 117 deletions

View File

@@ -45,7 +45,7 @@ jobs:
- name: Install mypy_primer
run: |
uv tool install "git+https://github.com/astral-sh/mypy_primer.git@add-red-knot-support-v5"
uv tool install "git+https://github.com/astral-sh/mypy_primer.git@add-red-knot-support-v6"
- name: Run mypy_primer
shell: bash