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
This is an interesting use of type annotations. I don't think it's feasible for us to add an exception for plum. Plum bends python semantics in a way that are difficult to understand for static analysis tools and we rather avoid coding framework specific behavior into ruff, unless it is a very popular framework.
I just tried your example with Pyright and it also reports error when type checking the code
/home/micha/astral/test/dispatch.py:4:5 - error: Function declaration "f" is obscured by a declaration of the same name (reportRedeclaration)
/home/micha/astral/test/dispatch.py:12:3 - error: Argument of type "Literal['test']" cannot be assigned to parameter "x" of type "int" in function "f"
"Literal['test']" is incompatible with "int" (reportArgumentType)
2 errors, 0 warnings, 0 information
Ruff does not recognize multiple dispatch methods.
Example:
Is there a way to include it as a rule to ignore the redefinition when there is
@dispatch
before the function?The text was updated successfully, but these errors were encountered: