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
If a concrete attribute has a narrower type than protocol attribute, mypy will complain (adapted from #5998):
prog.py:59: error: Argument 1 to "f" has incompatible type "C"; expected "Proto"
prog.py:59: note: Following member(s) of "C" have conflicts:
prog.py:59: note: name: expected "Optional[str]", got "str"
It could help if mypy would suggest making the protocol attribute read-only (property or final attribute), which is often the right thing to do.
We already generate a related suggestion to use a covariant collection type when using an invariant collection causes type incompatibility.