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
Activity
ilevkivskyi commented on Oct 25, 2018
Hm, it still fails on master, this is because of this code:
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
Fix covariant overriding of decorated methods (#8350)