-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
astral-sh/ruff
#22544Description
Summary
For this program, ty produces this error:
Argument is incorrect: Expected `(**_P@_inner) -> None`, found `(**_P@outer) -> None` (invalid-argument-type) [Ln 16, Col 13]
Since _P@_inner and _P@outer are the same _P in the same parameter position, they are obviously compatible. It isn't clear to me why ty is treating them as somehow incompatible.
import contextlib
from collections.abc import Callable, Iterator
from typing import ParamSpec
_P = ParamSpec("_P")
class Foo:
@contextlib.contextmanager
def outer(
self,
probe: Callable[_P, None],
*args: _P.args,
**kwargs: _P.kwargs,
) -> Iterator[None]:
with self._inner(
probe=probe,
):
yield
@contextlib.contextmanager
def _inner(
self,
probe: Callable[_P, None],
*args: _P.args,
**kwargs: _P.kwargs,
) -> Iterator[None]:
probe(*args, **kwargs)
yieldVersion
ty 0.0.9
Reactions are currently unavailable