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

TypeAlias forward reference results in Unknown #3654

Closed
Skynet0 opened this issue Nov 19, 2022 · 2 comments
Closed

TypeAlias forward reference results in Unknown #3654

Skynet0 opened this issue Nov 19, 2022 · 2 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@Skynet0
Copy link

Skynet0 commented Nov 19, 2022

Environment data

  • Language Server version: 2022.11.30
  • OS and version: linux x64
  • Python version (and distribution if applicable, e.g. Anaconda):
  • python.analysis.indexing: false
  • python.analysis.typeCheckingMode: strict

Code Snippet

from typing import TypeAlias

Foo: TypeAlias = "Bar"

class Bar:
    pass

x: Foo
x = Bar()

Repro Steps

Copy-paste the above code and see Pylance's highlighting / hover type hints.

Expected behavior

The type hints are correct, and Pylance does not error. The code typechecks according to mypy 0.991, and forward references in explicit type aliases are supported in PEP 613

Actual behavior

The type hints give red underlines. Bar is "Unknown".

image

erictraut pushed a commit to microsoft/pyright that referenced this issue Nov 19, 2022
…uoted (forward-declared) type was used in a statement with an explicit PEP-613 `TypeAlias` annotation. This addresses microsoft/pylance-release#3654.
@erictraut
Copy link
Contributor

Thanks for the bug report. This will be addressed in an upcoming 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-needed labels Nov 19, 2022
@rchiodo
Copy link
Contributor

rchiodo commented Nov 30, 2022

This issue has been fixed in prerelease version 2022.11.41, which we've just released. You can find the changelog here: CHANGELOG.md

@rchiodo rchiodo closed this as completed Nov 30, 2022
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