ruff
db8a67af - [ty] Preserve `ParamSpec` bindings inferred against type context (#28084)

Commit
75 days ago
[ty] Preserve `ParamSpec` bindings inferred against type context (#28084) When inferring a `ParamSpec`, we currently propagate a declared callable type as type context if provided. This causes us to discard the inferred signature of the `ParamSpec` in nested generic calls, leading to false positives and less precise diagnostics. For example, the following snippet currently errors: ```py from typing import Callable def wrap[**Q](callback: Callable[Q, None]) -> Callable[Q, None]: return callback def accept[**P](callback: Callable[P, None], *args: P.args, **kwargs: P.kwargs) -> None: ... def no_args() -> None: ... # error[invalid-argument-type]: Expected `(**P@accept) -> None`, found `def no_args() -> None` accept(wrap(no_args)) ```
Author
Parents
Loading