[PEP646] Add tests/fixes for callable star args behavior #15069
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds tests for mixing star args with typevar tuples from PEP646. In order to do this we have to handle an additional case in applytype where the result of expanding an unpack is a homogenous tuple rather than a list of types.
This PR also includes (partially by accident) a fix to the empty case for type analysis. After re-reading the PEP we discover that the empty case is meant to be inferred as a Tuple[Any, ...] rather than an empty tuple and must fix that behavior as well as some of the previous test cases that assumed that it meant an empty tuple.
When we actually call
target(*args)
from the testcase incall
we expose a crash in mypy. This will be handled by a subsequent PR.