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

Star unpacks as arguments to reveal_type() and assert_type() are not reported #9674

Open
InSyncWithFoo opened this issue Jan 8, 2025 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@InSyncWithFoo
Copy link
Contributor

InSyncWithFoo commented Jan 8, 2025

Minimal reproducible example (playground):

cast(*tuple[str, int], ...)                # no error
cast(Unpack[tuple[str, int]], ...)         # error: Unpack is not allowed in this context
cast(**dict[str, int], ...)                # error: "..." is not allowed in this context
cast(Unpack[dict[str, int]], ...)          # error: Unpack is not allowed in this context

assert_type(..., *tuple[str, int])         # error: expected "tuple[str, int]" but received "EllipsisType"
assert_type(..., Unpack[tuple[str, int]])  # error: Unpack is not allowed in this context
assert_type(..., **dict[str, int])         # error: expected "dict[str, int]" but received "EllipsisType"
assert_type(..., Unpack[dict[str, int]])   # error: Unpack is not allowed in this context

Unpack-ed types are not valid in these contexts and should be reported whatever forms they take.

@InSyncWithFoo InSyncWithFoo added the bug Something isn't working label Jan 8, 2025
erictraut added a commit that referenced this issue Jan 8, 2025
… an unpacked keyword argument in a call expression. Also added a check for an unpack operator used within the first argument of a `cast` call. This addresses #9674.
erictraut added a commit that referenced this issue Jan 8, 2025
… an unpacked keyword argument in a call expression. Also added a check for an unpack operator used within the first argument of a `cast` call. This addresses #9674. (#9675)
@erictraut
Copy link
Collaborator

There are two separate bugs here. One is a missing syntax error check for the case where a positional argument follows an unpacked keyword argument in a call expression (as in cast(**dict[str, int], ...)), and the other missing check is specific to the first positional argument of a cast call. Both of these will be addressed in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants