no error on possibly undefined attribute
Open
stale
typechecking
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 519
- PR merge metrics
- No merged PRs in 30d
Description
> not just platform checks, any conditionally defined attributes:
>
> ```py
> def condition() -> bool:
> return False
>
> class A:
> if condition():
> c: int = 0
>
> A.c # no error, crashes at runtime
> ```
>
> ty's [`possibly-missing-attribute`](https://docs.astral.sh/ty/reference/rules/#possibly-missing-attribute) rule catches this
_Originally posted by @DetachHead in [#2558](https://github.com/facebook/pyrefly/issues/2558#issuecomment-4677703877)_
opening a new issue because the example here still doesn't report an error on 1.2.0-dev.3
Contributor guide
Assessment
This issue has not been assessed yet.