ruff
55c7d485 - [ty] Consider object members in protocol comparisons (#27532)

Commit
37 days ago
[ty] Consider object members in protocol comparisons (#27532) ## Summary Consider attributes inherited from `object` when checking assignability between protocol types. - Reuse the same fallback policy in structural comparison and missing-member fast paths while preserving signature compatibility. - Preserve fast protocol mismatch rejection by caching `object` member names and each protocol's non-`object` requirement count. - Keep `__hash__` excluded because subclasses can disable hashing; `Iterator[int]` therefore remains incompatible with `Hashable`. Related to astral-sh/ty#4196. ## Test plan - Added mdtests for protocol requirements satisfied by `object.__repr__`. - Covered incompatible inherited method signatures and both custom and standard-library hashability requirements. - Verified the existing many-protocol-members mismatch benchmark retains its fast rejection path.
Author
Parents
Loading