This PR implements variance for type variables. To make UX pleasant for Python users who may not be familiar with type theory and variance, this property is inferred from usages of said variables.
It adds a VarianceInferrer class which walks a generic type definition recursively and tracks the polarity of its parameters' use sites, determining the final variance of each type variable.
The subtyping relationship check is also extended to handle comparing two AppliedType instances of the same generic base, taking into account the variance of type variables.
This PR implements variance for type variables. To make UX pleasant for Python users who may not be familiar with type theory and variance, this property is inferred from usages of said variables.
It adds a `VarianceInferrer` class which walks a generic type definition recursively and tracks the polarity of its parameters' use sites, determining the final variance of each type variable.
The subtyping relationship check is also extended to handle comparing two `AppliedType` instances of the same generic base, taking into account the variance of type variables.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This PR implements variance for type variables. To make UX pleasant for Python users who may not be familiar with type theory and variance, this property is inferred from usages of said variables.
It adds a
VarianceInferrerclass which walks a generic type definition recursively and tracks the polarity of its parameters' use sites, determining the final variance of each type variable.The subtyping relationship check is also extended to handle comparing two
AppliedTypeinstances of the same generic base, taking into account the variance of type variables.