Confusing error message when I forgot `global` keyword
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
I attempted to write the following incorrect code:
```
class A: ...
def f():
class A(A): ... # error: Class `f.A` inheriting from `f.A` creates a cycle
```
Pyrefly is right that there is an error in this code, but the real problem is that I need to add `global A` at the beginning of the function body. It would be really useful if it could somehow figure this out and tell me what I did wrong.
### Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQCCi9hbAOup5jGPWAAoAlIk71x9arQaMBjEazYgANCACuAF2hwS5RCADE9AKpaoEDaX5r0lLbnRxO3Xv1wAnALaoNAfXRqntgw7gL4LBDoGkL0ALQAfPRwGu6i6BL07jAaau7pYOwgAHKBwan0wPgAvoWcKiBkWWBQpIQauJ5QFEYACqRNLUkYOASSDpAA5rk%2BEA6EnEYAyjAw9AAWGhrEcIgA9LuNvC2EHhO7MOi7mLiUcLuU4xBT7jMOu27u9KgAbqjQqNhYGN0JNpvZ0rhiOCdJwyBo1g5Yt8QnBZukALz0QoAZkIAEYAEy1dAgKqqVB2CDIgBi0BgFDQWDwRDIpKAA
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.