[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:
David Peter 2025-05-10 11:59:25 +02:00 committed by GitHub
parent 235b74a310
commit cd1d906ffa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 40 additions and 10 deletions

View file

@ -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: