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

OrderedDict type annotation is rejected #151

Closed
A-UNDERSCORE-D opened this issue Jul 21, 2020 · 4 comments
Closed

OrderedDict type annotation is rejected #151

A-UNDERSCORE-D opened this issue Jul 21, 2020 · 4 comments
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@A-UNDERSCORE-D
Copy link

Environment data

  • Language Server version: v2020.7.2
  • OS and version: Ubuntu 20.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.2

Expected behaviour

Ordered Dict types from typing are understood and used for type checking in type annotations

Actual behaviour

Warning: Expected Class but received _Alias. Type inferred to Any or other inference based on assignment

Logs

[FG] parsing: /tmp/test.py (0ms)
[FG] binding: /tmp/test.py (1ms)
[BG] analyzing: /tmp/test.py ...
[BG]   parsing: /tmp/test.py (0ms)
[BG]   binding: /tmp/test.py (0ms)
[BG]   checking: /tmp/test.py (10ms)
[BG] analyzing: /tmp/test.py (11ms)

Code Snippet / Additional information

from typing import OrderedDict as odt, Any
from collections import OrderedDict

if __name__ == "__main__":
    test: odt[str, Any] = OrderedDict({"asd": None})
@erictraut
Copy link
Contributor

Thanks for your bug report.

This was also reported (yesterday) in the Pyright repo, and it has already been addressed there. A fix will be included in the next release of Pylance.

microsoft/pyright#864

@A-UNDERSCORE-D
Copy link
Author

Ah alright, would you like me to leave this open or close it?

@erictraut erictraut added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Jul 21, 2020
@erictraut
Copy link
Contributor

You can leave it, and we'll close it after the release. Thanks!

@jakebailey
Copy link
Member

This issue has been fixed in version 2020.7.3, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202073-21-july-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants