-
-
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
zip silently returns Any because of loose join with star types #3370
Comments
Related observations: this passes y: List[Tuple[int]]
reveal_type(list(*y)) # Revealed type is 'builtins.list[builtins.int*]' but fails at runtime with:
and similar for set etc. It looks like this is a general bug with star types. |
There may be a few edge cases left here, but in general mypy doesn't know enough about star types to tell its length ( Regarding the first case ( I'm not sure what to do for star-args with overloaded functions -- the "join" behavior seems reasonable enough to me in cases where the join is reasonable, e.g.: from typing import TypeVar, overload, List
T = TypeVar('T')
@overload
def zap(a: T) -> T: pass
@overload
def zap(a: T, b: T, c: T, *more: T) -> T: pass
def zap(*args): pass
a: List[int]
reveal_type(zap(*a)) # int
b: float
reveal_type(zap(b, *a)) # float |
I think |
Is this the rigvt tissue for that? |
I didn't find any other issue for this, so I propose to track this here. |
This appears to be fixed. The revealed type in the original post is now |
I think this is a bug since we should never silently infer
Any
from a precisely typed call.The text was updated successfully, but these errors were encountered: