In generic inheritance, we can't change the variance of a type from invariant to covariant/contravariant. This should probably be rejected:
IV = TypeVar('IV')
CV = TypeVar('CV', covariant=True)
class A(Generic[IV]): ... # Bunch of methods
class B(A[CV], Generic[CV]): pass # Error, type variable should be invariant
Going from covariant to invariant is fine (for example, List has to do this since it subclasses Sequence, which is covariant).
In generic inheritance, we can't change the variance of a type from invariant to covariant/contravariant. This should probably be rejected:
Going from covariant to invariant is fine (for example,
Listhas to do this since it subclassesSequence, which is covariant).