pyrefly
pyrefly copied to clipboard
panic: attempt to subtract with overflow in validate_type_guard_positional_argument_count
Describe the Bug
Pyrefly debug builds crash when checking this code:
from typing import TypeIs
class C:
def f() -> TypeIs[bool]:
pass
ERROR Thread panicked, shutting down: panicked at pyrefly/lib/alt/function.rs:1190:35:
attempt to subtract with overflow
Version info
20cce72d22
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
https://github.com/facebook/pyrefly/blob/d555b28cab00389e73a9e18b4d65c35f2a36570a/pyrefly/lib/alt/function.rs#L1190-L1198
This incorrectly assumes that if a method is not a staticmethod it will have either cls or self as its first argument. But of course, users can write code that is incorrect.
That should be handled here.