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

pyanalyze doesn't support defining TypeVar under if TYPE_CHECKING #744

Closed
hauntsaninja opened this issue Mar 10, 2024 · 0 comments · Fixed by #746
Closed

pyanalyze doesn't support defining TypeVar under if TYPE_CHECKING #744

hauntsaninja opened this issue Mar 10, 2024 · 0 comments · Fixed by #746

Comments

@hauntsaninja
Copy link
Contributor

from typing import TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
    _TypeT = TypeVar("_TypeT", bound=type)

    def c(cls: _TypeT) -> None:
        ...

gives:

Unrecognized annotation typing.TypeVar (code: invalid_annotation)
In b.py at line 6
   3: if TYPE_CHECKING:
   4:     _TypeT = TypeVar("_TypeT", bound=type)
   5: 
   6:     def c(cls: _TypeT) -> None:
                     ^
   7:         ...
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