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
[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.
The text was updated successfully, but these errors were encountered:
Fixes#1115 and #3352 by providing a link to docs and a suggestion.
This currently only takes care of 'List' and 'Dict', which are the most typical for this kind of errors.
[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:
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.
The text was updated successfully, but these errors were encountered: