ruff
70acda33 - [ty] Narrow TypeGuard keyword arguments, remove invalid-type-guard-call (#26809)

Commit
110 days ago
[ty] Narrow TypeGuard keyword arguments, remove invalid-type-guard-call (#26809) Closes astral-sh/ty#3991. ## Summary Stop emitting the `invalid-type-guard-call` diagnostic; a `TypeIs`/`TypeGuard` call without a narrowable target is valid and should simply have no narrowing effect. There's no indication in the typing spec or conformance suite that non-narrowing calls to type-guard functions should be an error, and this rule unnecessarily restricts flexible runtime use of such functions, which may not need to apply a static-analysis narrowing in all cases. Retain the rule for now with `LintStatus::removed` so existing configuration references receive a friendlier `unknown-rule` warning clarifying that the rule has been removed. (When we go to stable we should fully remove the rule.) Narrow explicit keyword arguments when they bind to the first non-`self`/`cls` formal parameter, including bound methods, unbound methods, class methods, and matching overloads. Never narrow any other parameter. ## Test plan mdtests cover keyword reordering, `TypeIs` and `TypeGuard`, literals/starred calls, omitted defaulted targets, multiple matching overloads, and bound/unbound/class-method calls.
Author
Parents
Loading