-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Show all overloads in error message #9177
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
Conversation
Thanks for the PR! I think that we can just always, unconditionally show all overloads. It may be bit verbose, but probably better since otherwise we'd be hiding important information. Could you simplify the PR to just make the change unconditional? |
What should I do in |
I was quite confused about what that method does, so let me ask differently: should it show all overloads, or should it show only the overloads that have the correct number of arguments but the arguments have wrong types? |
I made it show all the overloads |
Is there something else I need to do to get this merged? |
Sorry, I lost track of this PR. If you can fix the merge conflict, I can do the final review round now. |
I no longer need this PR, because I decided not to abuse overloads for what I was going to do with tkinter, but I'll try to get this fixed. |
Fixing the unit tests will take some time, many are failing :) |
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: pyppeteer (https://github.com/pyppeteer/pyppeteer.git)
- pyppeteer/network_manager.py:157: note: Possible overload variant:
+ pyppeteer/network_manager.py:157: note: Possible overload variants:
- pyppeteer/network_manager.py:157: note: <1 more non-matching overload not shown>
+ pyppeteer/network_manager.py:157: note: def [_T] get(self, key: <nothing>, default: _T) -> _T
- pyppeteer/network_manager.py:158: note: Possible overload variant:
+ pyppeteer/network_manager.py:158: note: Possible overload variants:
- pyppeteer/network_manager.py:158: note: <1 more non-matching overload not shown>
+ pyppeteer/network_manager.py:158: note: def [_T] get(self, key: <nothing>, default: _T) -> _T
edgedb (https://github.com/edgedb/edgedb.git)
- edb/server/connpool/pool.py:524:16: note: Possible overload variant:
+ edb/server/connpool/pool.py:524:16: note: Possible overload variants:
- edb/server/connpool/pool.py:524:16: note: <1 more non-matching overload not shown>
+ edb/server/connpool/pool.py:524:16: note: def [_T] get(self, key: <nothing>, default: _T) -> _T
pytest (https://github.com/pytest-dev/pytest.git)
+ src/_pytest/main.py:481: note: def __init__(self) -> _bestrelpath_cache
+ src/_pytest/main.py:481: note: def __init__(self, **kwargs: str) -> _bestrelpath_cache
- src/_pytest/main.py:481: note: <2 more non-matching overloads not shown>
- testing/test_config.py:422: error: Too many arguments for "DummyEntryPoint" [call-arg]
|
@JukkaL Ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! This makes things more consistent and also simplifies the code.
closes #9175