[ty] Share code-generator classification across specializations by charliermarsh · Pull Request #25701 · astral-sh/ruff (original) (raw)

Summary

CodeGeneratorKind::from_class currently keys its retained Salsa query by both the class and its specialization, even though type arguments cannot change whether a class is dataclass-like, a NamedTuple, or a TypedDict. Generic classes therefore retain duplicate classification entries for each specialization.

This removes specialization from the classification query and evaluates inherited code-generator behavior through the unspecialized MRO. Synthesized field and member types continue to use their specialization at the existing call sites; the added generic dataclass_transform coverage verifies that GenericModel[int] and GenericModel[str] retain distinct constructor types.