"Can only assign concrete classes to a variable of type "Type[MyProtocol]"" is hard to debug #8836
Labels
bug
mypy got something wrong
diagnostics
priority-2-low
topic-error-reporting
How we report errors
topic-protocols
topic-usability
If you consider bad error messages a bug, it is a bug. Otherwise, it is a feature request.
The following code sample is wrong because
name
is not optional. Definingname
's value in MyImplementation or its constructor would fix this code.However, running mypy from master or 0.770 produces an error which is very challenging to debug:
Ideally, mypy would tell me the underlying problem. In this case, I took nearly a whole day of experimenting to fix it, ultimately needing to delete code until I got the error message to change. It would be ideal if mypy could say "and it is not concrete because
name
is not defined statically or in__init__
." or something.What are the versions of mypy and Python you are using?
mypy 0.770, python 3.8, yes it persists on master
What are the mypy flags you are using? (For example --strict-optional)
This behavior seems unchanged by flags.
The text was updated successfully, but these errors were encountered: