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
Mypy allows an instance variable annotation on a subclass to restrict the variable’s type in a way that’s incompatible with the superclass. This is unsound and should be forbidden.
Bug Report
Mypy allows an instance variable annotation on a subclass to restrict the variable’s type in a way that’s incompatible with the superclass. This is unsound and should be forbidden.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.10&gist=00ef5dbb43039cac3d1672b3ece3029a&flags=strict
Mypy doesn’t give any errors, but should, because this fails at runtime with
TypeError: can only concatenate str (not "int") to str
.Expected Behavior
mypy should complain about
x: int
.Actual Behavior
No mypy errors.
Your Environment
--strict
The text was updated successfully, but these errors were encountered: