forked from microsoft/pyright
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#1161 from jakebailey/pull-pyright-124
Sync pyright
- Loading branch information
Showing
8 changed files
with
113 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/pyright/packages/pyright-internal/src/tests/samples/tuples12.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This sample tests type inference for tuples that contain unpack | ||
# operators. | ||
|
||
from typing import Literal | ||
|
||
|
||
def func1(a: int, *args: int): | ||
v1 = (a, *args) | ||
t1: Literal["tuple[int, ...]"] = reveal_type(v1) | ||
|
||
|
||
def func2(a: int, *args: str): | ||
v1 = (a, *args) | ||
t1: Literal["tuple[int | str, ...]"] = reveal_type(v1) | ||
|
||
|
||
def func3(a: int, b: str, *args: str): | ||
v1 = (*args, a, *args, b, *(a, b, a)) | ||
t1: Literal["tuple[str | int, ...]"] = reveal_type(v1) | ||
|
||
|
||
def func4(): | ||
a = 3.4 | ||
b = [1, 2, 3] | ||
v1 = (a, *b) | ||
t1: Literal["tuple[float | int, ...]"] = reveal_type(v1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters