[regression] isinstance complains about parametrized generics with any use of TypeAlias #18488
Labels
bug
mypy got something wrong
topic-runtime-semantics
mypy doesn't model runtime semantics correctly
topic-type-alias
TypeAlias and other type alias issues
Bug Report
Any attempt to call
isinstance
with a variable annotated as aTypeAlias
seems to result in the error messageerror: Parameterized generics cannot be used with class or instance checks
, even if the aliased type is non-generic. mypy_primer points at #18173 as the breaking commit, but that PR seems to have been intended to deal with type aliases of generic types; it seems that we're treating allTypeAlias
-based aliases as generic types, which AFAICT is broader than intended.To Reproduce
MyPy playground link, using current master
Expected Behavior
MyPy finds no errors, matching the runtime behavior. Pyright and mypy 1.4 both find no errors in my minimal example.
Actual Behavior
Per the playground link:
Your Environment
I found this when dogfooding mypy master commit c4e2eb7 against Dropbox's internal Python repo, but mypy_primer also reproduces the same thing, as does mypy playground.
The text was updated successfully, but these errors were encountered: