-
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 results in incorrect evaluation when passing a callabl…
…e with a "*args" parameter to a callable with a `Concatenate` and `ParamSpec`. This addresses #9630. (#9632)
- Loading branch information
Showing
3 changed files
with
63 additions
and
12 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
35 changes: 35 additions & 0 deletions
35
packages/pyright-internal/src/tests/samples/paramSpec54.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,35 @@ | ||
# This sample tests a function that uses a Concatenate with a callback | ||
# that has a *args parameter. | ||
|
||
from typing import Callable, Concatenate, reveal_type | ||
|
||
|
||
def func1[T, **P, R](fn: Callable[Concatenate[T, P], R], val: T) -> Callable[P, R]: | ||
... | ||
|
||
|
||
def test1(*args: str) -> None: | ||
... | ||
|
||
|
||
reveal_type(func1(test1, ""), expected_text="(*args: str) -> None") | ||
reveal_type(func1(func1(test1, ""), ""), expected_text="(*args: str) -> None") | ||
|
||
|
||
def test2(p1: int, *args: str) -> None: | ||
... | ||
|
||
|
||
reveal_type(func1(test2, 0), expected_text="(*args: str) -> None") | ||
reveal_type(func1(func1(test2, 0), ""), expected_text="(*args: str) -> None") | ||
reveal_type(func1(func1(func1(test2, 0), ""), ""), expected_text="(*args: str) -> None") | ||
|
||
|
||
def func2[T1, T2, **P, R]( | ||
fn: Callable[Concatenate[T1, T2, P], R], val1: T1, val2: T2 | ||
) -> Callable[P, R]: | ||
... | ||
|
||
|
||
reveal_type(func2(test1, "", ""), expected_text="(*args: str) -> None") | ||
reveal_type(func2(func2(test1, "", ""), "", ""), expected_text="(*args: str) -> None") |
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