Skip to content

Commit 057f9bf

Browse files
committed
Mandate error on inconsistent type variable order.
1 parent 6ac3196 commit 057f9bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/spec/generics.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,8 @@ That ``Child`` definition is equivalent to::
509509
class Child(Parent1[T1, T3], Parent2[T2, T3], Generic[T1, T3, T2]):
510510
...
511511

512-
Type checkers may warn when the type variable order is inconsistent::
512+
A type checker should report an error when the type variable order is
513+
inconsistent::
513514

514515
from typing import Generic, TypeVar
515516

@@ -521,7 +522,7 @@ Type checkers may warn when the type variable order is inconsistent::
521522
...
522523
class Parent(Grandparent[T1, T2]):
523524
...
524-
class Child(Parent[T1, T2], Grandparent[T2, T1]): # Inconsistent order
525+
class Child(Parent[T1, T2], Grandparent[T2, T1]): # INVALID
525526
...
526527

527528
Abstract generic types

0 commit comments

Comments
 (0)