[ty] Silence false positives for PEP-695 ParamSpec annotations (#18001)
## Summary
Suppress false positives for uses of PEP-695 `ParamSpec` in `Callable`
annotations:
```py
from typing_extensions import Callable
def f[**P](c: Callable[P, int]):
pass
```
addresses a comment here:
https://github.com/astral-sh/ty/issues/157#issuecomment-2859284721
## Test Plan
Adapted Markdown tests
This commit is contained in:
@@ -249,10 +249,12 @@ Using a `ParamSpec` in a `Callable` annotation:
|
||||
```py
|
||||
from typing_extensions import Callable
|
||||
|
||||
# TODO: Not an error; remove once `ParamSpec` is supported
|
||||
# error: [invalid-type-form]
|
||||
def _[**P1](c: Callable[P1, int]):
|
||||
reveal_type(c) # revealed: (...) -> Unknown
|
||||
reveal_type(P1.args) # revealed: @Todo(ParamSpec)
|
||||
reveal_type(P1.kwargs) # revealed: @Todo(ParamSpec)
|
||||
|
||||
# TODO: Signature should be (**P1) -> int
|
||||
reveal_type(c) # revealed: (...) -> int
|
||||
```
|
||||
|
||||
And, using the legacy syntax:
|
||||
|
||||
Reference in New Issue
Block a user