ruff
ed768f07 - [ty] Preserve enum attributes on Self and bounded type variables (#27644)

Commit
59 days ago
[ty] Preserve enum attributes on Self and bounded type variables (#27644) ## Summary - Delegate bounded and constrained type-variable member lookup to the complete lookup behavior of each bound or constraint while preserving the original receiver for descriptors and `Self`. - Restore enum-derived `name`, `_name_`, `value`, and `_value_` attributes for implicit `self`, explicit `Self`, and enum-bounded or enum-constrained type variables. - Preserve class-object lookup, mixed instance/class-object constraints, custom enum-property overrides, and classmethod binding for narrowed `Self` and mixin receivers. - Fixes https://github.com/astral-sh/ty/issues/4229. ## Test plan - Extend enum mdtests to cover implicit `self`, explicit `Self`, explicitly annotated enum receivers, enum-bounded and enum-constrained type variables, special name/value attributes, explicitly annotated `_value_`, custom `enum.property` overrides, strict return checking, and literal-preserving `Self` return values. - Add generic mdtest coverage for type variables constrained to both ordinary instances and class objects. - Extend `Self` mdtests to cover truthiness-narrowed classmethod receivers and mixins narrowed to unrelated classes. --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Author
Parents
Loading