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

Support for precise *args/**kwargs type checking #275

Merged
merged 11 commits into from
Nov 23, 2021
Merged

Conversation

JelleZijlstra
Copy link
Contributor

Fixes #63.

Previously we did not type check calls that contained *args or **kwargs at all. This change rewrites the call checking code completely to run in pyanalyze itself (instead of relying on the inspect module) and fully supports *args and **kwargs.

@JelleZijlstra
Copy link
Contributor Author

Notes from internal testing:

  • It would be useful to support DictIncompleteValue where the key is a union of literals
  • It can be confusing to figure out where an argument comes from if you get an incompatible_argument error. We should add some note that says where the candidate comes from ("positional argument 1", "**kwargs").

JelleZijlstra added a commit that referenced this pull request Nov 23, 2021
For example, we'll now infer `[x for x in (1, 2)]` as `SequenceIncompleteValue(list, [KnownValue(1), KnownValue(2)])`. I expect this to help with some edge cases from #275.
@JelleZijlstra JelleZijlstra merged commit 16f1f83 into master Nov 23, 2021
@JelleZijlstra JelleZijlstra deleted the argskwargs branch November 23, 2021 23:28
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.

Type check calls with *args/**kwargs
1 participant