No error reported for incorrect arguments passed to function generic over a `ParamSpec`
Summary
ty no longer raises a diagnostic on this code:
from typing import ParamSpec, TypeVar, Callable
P = ParamSpec("P")
T = TypeVar('T')
def fn(p1: int, p2: int):
...
def submit(fn: Callable[P, T], *args: P.args, **kwargs: P.kwargs):
...
submit(fn, p1=1, p2="wrong")
Here's the link to the playground with the above snippet.
Here's a motivating example where this comes up (link).
from concurrent.futures import ThreadPoolExecutor
def fn(p1: int, p2: int):
...
with ThreadPoolExecutor() as executor:
executor.submit(fn, p1=1, p2="wrong")
I was originally going to submit this issue because I noticed that the diagnostic gave (what I think is) the correct error but highlighted p1 instead of p2, but as of today the diagnostic no longer appears at all.
Here's the original diagnostic issue using ty as built into Zed, updated yesterday. (Notice the 1 is underlined instead of "wrong".)
Version
main (2a61fe235)
Thanks for the report! I'm not totally sure that this ever worked -- I think the error you were seeing before was an unrelated bug 😆
But it definitely should work, agreed!
Thanks, the original error fooled me into thinking this was already supported!
@dhruvmanila, is this related to the last bullet point in https://github.com/astral-sh/ty/issues/1861?