facebook / facebook/pyrefly

`implicitly-defined-attribute` false negative on attributes defined on the class

Open
#3,660 0 comments 0 reactions 1 assignee Claimed by @shobhitmehro View on GitHub
typechecking
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

```python
class A:
foo: int # no error

A().foo # no error, crashes at runtime
```

[pyright's `reportUninitializedInstanceVariable` catches this](https://basedpyright.com/?pyrightVersion=1.39.5&typeCheckingMode=all&code=MYGwhgzhAECCBcBYAUNN0BmB7L9oEsA7AFxRVgAoBKAOmyyA)

### Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQCCiAOgE4vr3f1i66J6EdABd6AYnrpc9GGza4OHdO06MAFAEpCfGZOmz5igDT1KbWgAt49VGLYBXURAC2MEMZBk2MMFFKEIrguUBSSAAqkPn6k9GhYePhmuOiQAOYOFiIQKYSckgDKMDD0liIixHCIAPTV3r7%2BhIpp1TDo1Zi4lHDVlCnpmXY57byKtgBuqNCo2LDJqRAZWcP0uMTZKXB56GQilikAtONycCsAvPQsIADMhACMAExXnADacgpscAC6nE6uxIoRDBMAdMBAfJRssd6BcAOSLaQ%2BWGcaQiA4%2BACODnBwIOAGsYKQDqhKJR4Aw4QB3VBsdDI9D-KAQSgQNEYWJw96KekwfDEJkstnoDn0WFctj0xnM1n%2BUG%2BYS4uwiNgQbAOIEw0Xi2EgAC%2BnhJUJgADFoO5ECB4jgCCRyLqgA

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.