-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add TypeVarTupleExpr node #12481
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
Add TypeVarTupleExpr node #12481
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1460,3 +1460,13 @@ heterogenous_tuple: Tuple[Unpack[Tuple[int, str]]] | |
homogenous_tuple: Tuple[Unpack[Tuple[int, ...]]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add at least one AST dump test case to |
||
bad: Tuple[Unpack[int]] # E: builtins.int cannot be unpacked (must be tuple or TypeVarTuple) | ||
[builtins fixtures/tuple.pyi] | ||
|
||
[case testTypeVarTuple] | ||
from typing_extensions import TypeVarTuple | ||
|
||
TVariadic = TypeVarTuple('TVariadic') | ||
TP = TypeVarTuple('?') # E: String argument 1 "?" to TypeVarTuple(...) does not match variable name "TP" | ||
TP2: int = TypeVarTuple('TP2') # E: Cannot declare the type of a TypeVar or similar construct | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also test calling |
||
TP3 = TypeVarTuple() # E: Too few arguments for TypeVarTuple() | ||
TP4 = TypeVarTuple('TP4', 'TP4') # E: Only the first argument to TypeVarTuple has defined semantics | ||
TP5 = TypeVarTuple(t='TP5') # E: TypeVarTuple() expects a string literal as first argument |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add docstring for this and also modify the docstring of TypeVarLikeExpr