Skip to content
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

Skip overlapping overload check at large overload counts #15865

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hauntsaninja
Copy link
Collaborator

Fixes #10004

An alternate fix would be to only check the first 100 overloads for overlaps.

@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternate fix would be to only check the first 100 overloads for overlaps.

I think I'd weakly prefer that? Performance is obviously still very important for us, but it's not as important as it is for pyright, since pyright doubles as a language server. And it feels weird that you might get 50 overlapping-overload errors if you had 99 overloads, but then that number drops to 0 when you added one more overload.

@ilevkivskyi
Copy link
Member

Yeah, I don't like silently skipping all checks if there are many overloads. I think we should just limit inner loop to say 100 next items, this way we will check all "nearby" overloads with linear complexity. Also if we hit this limit, we should show an error on the first line saying that some checks were skipped (as we do e.g. for union math). User may then place a single # type: ignore to suppress this warning.

Also we can still always do the implementation completeness check that is linear (and it doesn't affect stubs anyway).

@hauntsaninja hauntsaninja marked this pull request as draft September 1, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Polynomial time-complexity of typing.overload
3 participants