[red-knot] Fix MRO inference for protocol classes; allow inheritance from subscripted Generic[]; forbid subclassing unsubscripted Generic (#17452)

This commit is contained in:
Alex Waygood
2025-04-18 20:55:53 +01:00
committed by GitHub
parent fd3fc34a9e
commit 454ad15aee
13 changed files with 345 additions and 139 deletions

View File

@@ -117,6 +117,7 @@ from typing import Tuple
class C(Tuple): ...
# revealed: tuple[Literal[C], Literal[tuple], Literal[Sequence], Literal[Reversible], Literal[Collection], Literal[Iterable], Literal[Container], @Todo(protocol), Literal[object]]
# TODO: generic protocols
# revealed: tuple[Literal[C], Literal[tuple], Literal[Sequence], Literal[Reversible], Literal[Collection], Literal[Iterable], Literal[Container], @Todo(`Protocol[]` subscript), @Todo(`Generic[]` subscript), Literal[object]]
reveal_type(C.__mro__)
```