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
Hm, it still fails on master, this is because of this code:
elifis_equivalent(original_type, typ):
# Assume invariance for a non-callable attribute here. Note# that this doesn't affect read-only properties which can have# covariant overrides.## TODO: Allow covariance for read-only attributes?passelse:
# ...give error
I think this is easy to fix by replacing is_equivalent with is_subtype at least for effectively read-only attributes. Anyway mypy currently allows covariant overriding for mutable attributes although this is technically unsafe, see #3208
I'm raising a bug.
It's also posted on SO at https://stackoverflow.com/q/52744713/5986907
I get
for file.py
I'd expect there to be no error as Y is a subclass of X.
I've tried this with mypy 0.630 and Python 3.5.2, 3.6.6 and 3.7.0. Also with mypy git master for python 3.5.2 and 3.7.0
It's possible these are related but I couldn't quite connect them
#220
#4430
The text was updated successfully, but these errors were encountered: