-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Error in subclass of generic base at None #1956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Initial results from debugging: this is a mismatch between certain code using When we report this error, the stack looks like this:
and the issue is that the arguments That, in turn, comes because in the caller:
when we applied I'm not sure whether the immediate right fix is more In the commit message of #1562 "Pr/strict optional", I see
So it looks like what's happening is that the return type of the new definition is duly a @ddfisher, can you fill in more of the story around that remark in the commit message? Do you have thoughts on how best to fix this, either for a quick fix to unblock further progress or for the longer term? |
Side conclusion from that bit of debugging: the reason the error message is confusing is that it's rendering both a Quite possibly the ultimate solution will be to eliminate |
This will probably be resolved by doing #1975. |
Under
--strict-optional
, when inheriting from a generic base class applied to None, method implementations on the subclass can produce spurious errors like so:Note there's no error when the same thing is done with
int
instead ofNone
. There's also no error without--strict-optional
.This issue causes about 109 error messages when type-checking mypy itself under
--strict-optional
, in various subclasses ofNodeVisitor[None]
andTypeVisitor[None]
.I haven't tried hard to reduce this repro -- it's possible that some of the elements of it are unnecessary.
The text was updated successfully, but these errors were encountered: