Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Imported complex types resolve to unresolved symbols #559

Closed
DonJayamanne opened this issue Jan 28, 2019 · 3 comments
Closed

Imported complex types resolve to unresolved symbols #559

DonJayamanne opened this issue Jan 28, 2019 · 3 comments

Comments

@DonJayamanne
Copy link

@patrys commented on Fri Jan 25 2019

Environment data

  • VS Code version: 1.31.0-insider
  • Extension version (available under the Extensions sidebar): 2018.12.1 (language server 0.1.78)
  • OS and version: macOS 10.14.2
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.2 from Homebrew
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions: N/A

Expected behaviour

Importing a complex type like MyType = Callable[Foo, Bar] works.

Actual behaviour

Language server reports an error when the type is used: 'Foo' used before definition.

Steps to reproduce:

# foo.py
from typing import AsyncIterator, Callable

Foo = Callable[..., AsyncIterator]
# bar.py
from .foo import Foo

x: Foo

You should get an error reported for the word Foo in bar.py.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Microsoft Python Language Server version 0.1.78.0
Initializing for [redacted]

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

N/A
@jakebailey
Copy link
Member

I believe this is a deficiency in the old analyzer, which I don't believe supports indirect imports of things from typing. The new analyzer should handle this better.

@MikhailArkhipov
Copy link

Most popular types from typing are now specialized. Additional types will come as part of #535 eventually.

@MikhailArkhipov
Copy link

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants