mypy --strict has misleading suggestion for Callable #11757
Labels
bug
mypy got something wrong
good-first-issue
topic-configuration
Configuration files and flags
topic-error-reporting
How we report errors
topic-usability
Bug Report
It's not a big issue, not sure if you should even qualify it as a bug but I fought it fitted better than other categories.
When in strict mode, it gives a suggestion that is actually not valid in strict mode.
To Reproduce
Running
mypy --strict
on this codegives the following error message:
However, changing the code to use the second suggestion of using
Callable
:gives a new error message:
Running mypy in non-strict mode does not give this error. But if it is at all possible it would be nice to remove the second suggestion in strict mode (or turn it into
Callable[..., Any]
).I got confused (didn't spot that I was missing an
Any
return value in myCallable[...]
annotation) and kept switching back and forth wondering why the suggestion was not working. Which admittedly is my mistake. But it did bring to light for me that the suggestion is a bit misleading in this context.I don't know if this is easily done or not, if it's a relatively minor fix I'd be willing to give it a crack.
Additional info:
The text was updated successfully, but these errors were encountered: