Open srittau opened 2 weeks ago
We should check how many become unused with the mypy master branch, as the way the lint works at mypy has just been completely reworked in https://github.com/python/mypy/pull/17392.
That sounds promising!
So yes, these are mypy's new complaints regarding overload-overlap if you use mypy master
, fiddle with mypy's master
branch so that you get rid of the thing where it stops --warn-unused-ignores
from working inside typeshed directories, then fiddle with our mypy_test.py
so that it ignores the override
error code (because there's a bunch of new errors from that error code on mypy master
which are unrelated to the thing we're discussing here), and then run python tests/mypy_test.py stdlib -p3.13
:
And in our third-party stubs we have:
So in total that's around 60 that will go away altogether. That will still leave us with quite a few errors ignored in typeshed, and I agree we don't get much value from the check. (We already have pyright's version switched off, because it was even noisier than mypy's.)
Diff I made to mypy to get --warn-unused-ignore
working:
Diff I made to our tests:
My gut feeling says that we should disable the test even after the PR (as you also wrote), but maybe it's a good idea to do this after the next mypy release, as a baseline.
These mypy warnings are overzealous, as it's often quite useful to have partial overlaps: We ignore this warning in 192 places in typeshed at the moment, and I don't think we gain any benefit from having it enabled.
Ideally, mypy would have a separate warning for overloads that are completely shadowed by another overload, though.