Alex Waygood
d02c9ada5d
[ty] Do not carry the generic context of Protocol or Generic in the ClassBase enum ( #17989 )
...
## Summary
It doesn't seem to be necessary for our generics implementation to carry
the `GenericContext` in the `ClassBase` variants. Removing it simplifies
the code, fixes many TODOs about `Generic` or `Protocol` appearing
multiple times in MROs when each should only appear at most once, and
allows us to more accurately detect runtime errors that occur due to
`Generic` or `Protocol` appearing multiple times in a class's bases.
In order to remove the `GenericContext` from the `ClassBase` variant, it
turns out to be necessary to emulate
`typing._GenericAlias.__mro_entries__`, or we end up with a large number
of false-positive `inconsistent-mro` errors. This PR therefore also does
that.
Lastly, this PR fixes the inferred MROs of PEP-695 generic classes,
which implicitly inherit from `Generic` even if they have no explicit
bases.
## Test Plan
mdtests
2025-05-22 21:37:03 -04:00
..
2025-05-21 11:06:27 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-19 17:24:25 -04:00
2025-05-19 17:24:25 -04:00
2025-05-19 17:24:25 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-21 15:38:56 -04:00
2025-05-13 18:43:19 +02:00
2025-05-21 18:02:39 -04:00
2025-05-21 18:02:39 -04:00
2025-05-16 06:57:26 +02:00
2025-05-22 21:37:03 -04:00
2025-05-15 11:39:14 -04:00
2025-05-15 11:39:14 -04:00
2025-05-14 11:13:41 -04:00
2025-05-14 11:13:41 -04:00
2025-05-14 11:13:41 -04:00
2025-05-14 11:13:41 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-21 17:38:07 +00:00
2025-05-14 08:26:48 +02:00
2025-05-14 08:26:48 +02:00
2025-05-14 08:26:48 +02:00
2025-05-14 08:26:48 +02:00
2025-05-14 08:26:48 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-19 17:24:25 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-19 17:24:25 -04:00
2025-05-13 18:43:19 +02:00
2025-05-21 11:06:27 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00