-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix special cases of kwargs + TypeVarTuple #17512
base: master
Are you sure you want to change the base?
Conversation
cc @ilevkivskyi since I saw your changes w/r/t typevartuples when glancing over the merge conflicts. Maybe you'll have an idea of whether this Any-tuple thing is worth anything. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
With the simplification from removing Any-tuple this looks pretty damn clean. With no diff from mypy_primer I think we only need new tests and then it's pretty much ready to merge 🎉 |
Turns out I can't split anything off because the two fixes need each other for any visible effect. |
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Fixes #16522. This PR adds special casing for TypeVarTuple inference in the face of kwargs, though I believe the general case requires providing multiple possible constraints (e.g. "constraint a OR constraint b OR constraint C") which either isn't possible or I don't know how to.
This PR also fixes the subtyping of e.g.
def f(a: int) -> None
being a subtype ofdef g(*args: Unpack[tuple[Any, ...]])
.TODO:
operator.call
producearg-type
error with callables that take*args: Unpack[Ts]
and >= 1 keyword argument #16662.