pyright icon indicating copy to clipboard operation
pyright copied to clipboard

is_dataclass always evaluates to false with TypeVars

Open peku33 opened this issue 6 months ago • 1 comments

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()

peku33 avatar Aug 07 '24 09:08 peku33