Keyword-only first argument in instance method not reported
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
Tested on Pyright 1.1.406, Python 3.14
```py
class A:
def meth1(*, x: int = 42) -> None:
pass
def meth2(*, x: int) -> None:
pass
A().meth1() # no error
A().meth2(x=57) # no error
```
Both method calls will fail at runtime. Pyright does not report any diagnostics for this file.
`mypy` does report errors both for the method definitions and for the calls (so that e.g. you can keep these functions if you need backwards compatibility, while still keeping type safety when they are used).
Contributor guide
Research direction
Start with the Python reproducer in the issue and compare Pyright's behavior with mypy for the two keyword-only instance method definitions and calls. Trace the relevant Pyright analysis entry point, then add or update coverage so diagnostics are reported for both invalid definitions and calls, and verify the reproducer passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100