You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Give better error messages when there are covariance/invariance related errors #1115
[The following is adapted from discussion at #1113. Go there for more context.]
We should give output like this for some invariance violations, as many programmers expect everything to be covariant and it may not be obvious why mypy is complaining:
$ mypy file.py
file.py:7: error: Argument 1 to "f" has incompatible type Dict[str, List[int]]; expected Dict[str, Sequence[int]]
file.py:8: note: The second type parameter of "Dict" is invariant; consider using "Mapping" instead, which is covariant
This would give more context even for somebody who doesn't understand covariance/invariance -- these terms are easy to google.
Even better, we could give a pointer to relevant documentation.
Activity
quartox commentedon May 22, 2017
I will start looking at this.
Add informative notes to invariant function arguments (#3411)