pyright doesn't catch trivial unbount attributes in __init__
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
Pyright doesn't detect unbound attributes in `__init__`. Strangely enough, other type-checkers don't catch this, too. Which means it might not be a bug?
**Code or Screenshots**
```python
class A:
def __init__(self)->None:
print(self.x)
self.x: int = 2
a = A()
```
```bash
$ uvx pyright --version
pyright 1.1.408
$ uvx pyright a.py
0 errors, 0 warnings, 0 informations
```
Contributor guide
Research direction
Reproduce the report using the provided A class in a.py and the shown uvx pyright command with version 1.1.408. Trace how Pyright analyzes attribute access and annotations inside __init__; done means establishing whether the access should produce a diagnostic and covering the chosen behavior with a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100