You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect mypy to support a union type alias within an isinstance call to avoid duplication.
Actual Behavior
pep-604.py:16: error: Parameterized generics cannot be used with class or instance checks [misc]
pep-604.py:16: error: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "_ClassInfo" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
Mypy version used: mypy 1.6.1 (compiled: yes)
Mypy command-line flags:
Mypy configuration options from mypy.ini (and other config files):
Python version used: 3.11.0
The text was updated successfully, but these errors were encountered:
Bug Report
PEP 604 introduced union type syntax
X | Y
which included support for the new syntax within calls toisinstance
andissubclass
.mypy
complains about code which runs correctly at runtime.To Reproduce
Gist URL: https://gist.github.com/mypy-play/4be2e08fa1da185af6e821705ea85744
Playground URL: https://mypy-play.net/?mypy=latest&python=3.11&gist=4be2e08fa1da185af6e821705ea85744
Expected Behavior
I would expect
mypy
to support a union type alias within anisinstance
call to avoid duplication.Actual Behavior
Your Environment
mypy 1.6.1 (compiled: yes)
mypy.ini
(and other config files):3.11.0
The text was updated successfully, but these errors were encountered: