Skip to content

New semantic analyzer: better error messages for cyclic cross-module definitions #6551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ilevkivskyi opened this issue Mar 15, 2019 · 0 comments
Labels
priority-1-normal semantic-analyzer Problems that happen during semantic analysis topic-error-reporting How we report errors topic-usability

Comments

@ilevkivskyi
Copy link
Member

This is a follow-up for #6527

The new analyzer gives to verbose (and a bit confusing) error in this case:

[case testNewAnalyzerCyclicDefinitionCrossModule]
import b
[file a.py]
import b
x = b.x  # E: Cannot determine type of 'x'
[file b.py]
import a
x = a.x  # E: Cannot resolve attribute "x", possible cyclic definition \
         # E: Module has no attribute "x"

We can probably skip the second part by injecting a dummy Var with Any type in the a module namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-1-normal semantic-analyzer Problems that happen during semantic analysis topic-error-reporting How we report errors topic-usability
Projects
None yet
Development

No branches or pull requests

2 participants