Covariant type variable error in nested function #8191
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-type-variables
I believe the below code should be allowed:
I believe the purpose of this error is to disallow breaking variance, e.g.:
However, restricting variance on nested functions has both false positives (first example), and false negatives:
The above code has no error, but is not type safe. I believe the proper way to check for this is to look at the signatures of each exposed method and verify that the type parameter is not used with the wrong parity.
mypy 0.740, python 3.7.5
The text was updated successfully, but these errors were encountered: