-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix overload resolution on Tuples #1585
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
def f(x: int, y: Tuple[str, ...]) -> None: pass | ||
@overload | ||
def f(x: int, y: str) -> None: pass | ||
f(1, ('2', '3')) |
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.
Also test calling with a Tuple[str, ...]
arg and a Tuple[int, ...]
argument.
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.
Added.
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.
Oops, now it's actually added.
1ec67ba
to
b162a4a
Compare
Fixes python#1578, since list's __setitem__ is overloaded.
b162a4a
to
ab2a7b2
Compare
@rwbarton Feel free to land this PR at any time if tests pass after fixing rebase conflicts. Sorry for the delay! |
Hmm, I thought I commented somewhere about this PR being unneeded after #1596, but now I can't find that comment... |
Oh right, I remember now. # Fall back to a conservative equality check for the remaining kinds of type.
return 2 if is_same_type(erasetype.erase_type(actual), erasetype.erase_type(formal)) else 0 With the change to I'll still merge the tests though since they are a bit different than the ones added in #1596. |
I added the tests in commit 838b4e0. |
Fixes #1578, since list's setitem is overloaded.