pyright
pyright copied to clipboard
is_dataclass always evaluates to false with TypeVars
dataclasses.is_dataclass
seems to always evaluate to false for generic types.
Environment data
- Language Server version: 2024.8.1
- OS and version: darwin arm64
- Python version (and distribution if applicable, e.g. Anaconda): 3.11.9
- python.analysis.indexing: true
- python.analysis.typeCheckingMode: strict
Code Snippet
from dataclasses import is_dataclass
from typing import TypeVar
T = TypeVar("T")
def test_fn(type_: type[T]) -> T:
assert is_dataclass(type_)
print("this is marked as unreachable")
raise NotImplementedError()