-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug that resulted in a false positive error when one ParamSpec …
…was captured by another ParamSpec. This addresses #6741.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 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
38 changes: 38 additions & 0 deletions
38
packages/pyright-internal/src/tests/samples/paramSpec50.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,38 @@ | ||
# This sample tests the case where a ParamSpec captures another ParamSpec. | ||
|
||
from typing import Callable, Iterator, ParamSpec, TypeVar | ||
|
||
P = ParamSpec("P") | ||
T = TypeVar("T") | ||
|
||
|
||
def deco1(func: Callable[P, Iterator[T]]) -> Callable[P, Iterator[T]]: | ||
... | ||
|
||
|
||
@deco1 | ||
def func1( | ||
func: Callable[P, str], | ||
*func_args: P.args, | ||
**func_kwargs: P.kwargs, | ||
) -> Iterator[str]: | ||
... | ||
|
||
|
||
def func2(a: int, b: float) -> str: | ||
... | ||
|
||
|
||
def func3(a: int) -> str: | ||
... | ||
|
||
|
||
func1(func2, 3, 1.1) | ||
|
||
# This should generate an error. | ||
func1(func2, 3.1, 1.1) | ||
|
||
func1(func3, 3) | ||
|
||
# This should generate an error. | ||
func1(func3) |
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