Support functools.singledispatchmethod
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 519
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
Pyrefly currently doesn't model functools.singledispatchmethod(split from https://github.com/facebook/pyrefly/issues/1006) -- decorated methods lose per-type dispatch, .register overloads are ignored, and calls fall back to Any.
Should handle:
- Decorated method stays callable, bound with its self/cls receiver.
- Dispatch on the first non-self arg.
- Both .register forms: annotated first param, and .register(SomeType).
- Inheritance: one shared registry per descriptor (registrations are visible on subclasses and leak across the hierarchy, with no per-class registry).
Contributor guide
Research direction
No implementation files or tests are named. Start by locating Pyrefly's model for functools and the handling of singledispatch or descriptor methods, then inspect issue 1006 for prior context. Done means preserving bound methods, dispatching on the first non-self argument, supporting both .register forms, and sharing registrations across inheritance as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100