Mypy is still too eager about outer context #5874
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-type-variables
topic-union-types
Consider this example:
It fails on the last line with the following (I skip invariance notes):
If I remove the annotation for
e
, everything works fine.When previously working on the external context issues, I found that I don't like how constrains for unions against unions are inferred (not that they are wrong, just counterintuitive). For example,
Union[T, S] <: Union[str, int]
infersT < : Union[str, int] and S <: Union[str, int]
, which is technically fine, but leads to errors like above.This blocks #5873
The text was updated successfully, but these errors were encountered: