Skip to content
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

Invalid range when adding declaration for modules imported using from ..a import b syntax #4521

Closed
andrestone opened this issue Jan 24, 2023 · 0 comments · Fixed by #4522
Closed

Comments

@andrestone
Copy link
Contributor

andrestone commented Jan 24, 2023

Describe the bug

When adding declaration to symbols, there's at least one case where the resolved declaration (which is obtained via the submodule fallback) is of type Alias and it refers to a module, still the range is populated with the symbol data, causing clients to try to navigate to inexistent locations.

To Reproduce
Use the following project structure:

.
├── pyright_bug
│   ├── __init__.py
│   └── main.py
└── pyright_bug_2
    ├── __init__.py
    └── bug.py
#  pyright_bug/main.py
from ..pyright_bug_2 import bug #  <- this symbol's declaration resolves to the right path but an inexistent range (the symbol's own range)
# pyright_bug_2/bug.py
BUG="HERE"

Expected behavior
Declarations of modules should resolve with an empty range.

@andrestone andrestone changed the title Invalid range when adding declaration for modules imported using from .a import b syntax Invalid range when adding declaration for modules imported using from ..a import b syntax Jan 24, 2023
erictraut pushed a commit that referenced this issue Jan 24, 2023
This addresses #4521
Co-authored-by: Eric Traut <eric@traut.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant