You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bad-argument-type - false negative when calling decorator function with wrong type #5536
changed the title [-]no error when calling decorator function with wrong type[/-][+]`bad-argument-type` - false negative when calling decorator function with wrong type[/+]on Nov 5, 2026
defdeco(cls: int) ->int: ...
classBaz: ...
deco(Baz) # error: Argument `type[Baz]` is not assignable to parameter `cls` with type `int` in function `deco` [bad-argument-type]
pyright and mypy have had similar issues in the past, caused by the fact that they also use different logic for checking decorator calls for some reason. ideally it should use the same logic used for checking a regular function call to avoid issues like this.
Activity
[-]no error when calling decorator function with wrong type[/-][+]`bad-argument-type` - false negative when calling decorator function with wrong type[/+]DetachHead commentedon Nov 5, 2026
it works when calling the function normally:
pyright and mypy have had similar issues in the past, caused by the fact that they also use different logic for checking decorator calls for some reason. ideally it should use the same logic used for checking a regular function call to avoid issues like this.
rchen152 commentedon Nov 5, 2026
Likely related: #1180
connernilsen commentedon Nov 5, 2026
Yeah, I think #2294 (PR for #1180) may fix this, but will keep an eye on it to make sure once it's landed