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

PyLance misunderstand return type as an object instead of a class #1406

Closed
hspadim-at-dunamis opened this issue Jun 7, 2021 · 2 comments
Closed
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@hspadim-at-dunamis
Copy link

Environment data

  • Language Server version: 2021.6.0
  • OS and version: linux x64
  • Python version (and distribution if applicable, e.g. Anaconda): Python 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0] on linux
  • python.analysis.indexing: undefined
  • python.analysis.typeCheckingMode: off

Expected behaviour

from typing import NewType, Literal
from pydantic import constr

ExchangeName = NewType(
    "ExchangeName", constr(strip_whitespace=True, min_length=0, max_length=50)
)

Actual behaviour

from typing import NewType, Literal
from pydantic import constr

# Throw error
# Expected class as second argument to NewType Pylance
ExchangeName = NewType(
    "ExchangeName", constr(strip_whitespace=True, min_length=0, max_length=50)
)
@github-actions github-actions bot added the triage label Jun 7, 2021
@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Jun 7, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.6.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202161-9-june-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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