-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a recent regression that results in false positive errors under…
… certain circumstances that involve assignability checks for two callables that involve a `*args: *tuple[]` parameter. This addresses #9238.
- Loading branch information
Showing
5 changed files
with
47 additions
and
7 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
29 changes: 29 additions & 0 deletions
29
packages/pyright-internal/src/tests/samples/tupleUnpack5.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,29 @@ | ||
# This sample tests cases where an unpacked tuple is used in | ||
# an overload. | ||
|
||
|
||
from typing import Callable, Concatenate, overload | ||
|
||
|
||
@overload | ||
def func1[**P, R](func: Callable[P, R], /, *args: *tuple[()]) -> Callable[P, R]: ... | ||
@overload | ||
def func1[**P, R]( | ||
func: Callable[Concatenate[int, P], R], /, *args: *tuple[int] | ||
) -> Callable[P, R]: ... | ||
@overload | ||
def func1[**P, R]( | ||
func: Callable[Concatenate[int, int, P], R], /, *args: *tuple[int, int] | ||
) -> Callable[P, R]: ... | ||
|
||
|
||
def func1[**P, R](func: Callable[..., R], /, *args: object) -> Callable[..., R]: ... | ||
|
||
|
||
@overload | ||
def func2(*args: *tuple[int]) -> int: ... | ||
@overload | ||
def func2(*args: *tuple[int, int, int]) -> int: ... | ||
|
||
|
||
def func2(*args: *tuple[int, *tuple[int, ...]]) -> int: ... |
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