ruff
f242f371 - [ty] Preserve declaration order when synthesizing class fields (#25249)

Commit
2 days ago
[ty] Preserve declaration order when synthesizing class fields (#25249) ## Summary Prior to this change, field synthesis could accidentally follow symbol-table order instead of class-body declaration order in pathological cases like: ```python from dataclasses import InitVar, dataclass from ty_extensions import Top @dataclass class C: a: Top[int] int: InitVar[int] = 0 ``` Here, `int` can be interned before its own declaration because it already appears in `Top[int]`. This PR carries a stable declaration ordinal through declaration lookup and uses it when building `own_fields()`. Closes https://github.com/astral-sh/ty/issues/3493.
Author
Parents
Loading