ruff
329b7132 - [ty] Fix inference of `t.__mro__` if `t` is an instance of `type[Any]` (#23632)

Commit
20 hours ago
[ty] Fix inference of `t.__mro__` if `t` is an instance of `type[Any]` (#23632) ## Summary I started off this PR trying to fix these conformance-suite assertions: - https://github.com/python/typing/blob/6b1a64cfbfab5e07a28fb5a811011449cb60b04b/conformance/tests/specialtypes_type.py#L102 - https://github.com/python/typing/blob/6b1a64cfbfab5e07a28fb5a811011449cb60b04b/conformance/tests/specialtypes_type.py#L110 But, alas... after starting on the PR, I realised that (as with many of the conformance-suite assertions regarding `type[]` types), I disagreed with the assertions being made! If `type[Any]` is equivalent to `type & Any` (and I [believe it is!](https://github.com/astral-sh/ty/issues/222)), then the inferred type of `t.__mro__` where `t: type[Any]` should not be `tuple[type, ...]`; it should be `tuple[type, ...] & Any`. Anyway, this PR improves semantics, I think, even if it will sadly not improve our conformance score. EDIT: oh, huh, it actually improves our conformance score anyway? I guess the error code changes from `type-assertion-failure` to `assert-type-unspellable-subtype`? Nice. ## Test Plan mdtests --------- Co-authored-by: Claude <noreply@anthropic.com>
Author
Parents
Loading