-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statement
Description
Bug Report
trying to match-case by class collections.abc.Callable
raises
error: Expected type in class pattern; found "typing._SpecialForm" [misc]
To Reproduce
https://mypy-play.net/?mypy=master&python=3.10&gist=29d49c837fadc7e404ea295c82d0d28a
from collections.abc import *
x = {1:1}
match x:
case Mapping():
print("Mapping")
case Sequence():
print("Sequence")
case Callable(): # ✘ error: Expected type in class pattern [misc]
print("Callable")
Expected Behavior
Given that collection.abc
classes are isinstance
-checkable, and it works with the others it should work here as well.
Your Environment
Tested with 0.981, 0.982 and master branch
https://mypy-play.net/?mypy=master&python=3.10&gist=29d49c837fadc7e404ea295c82d0d28a
Hnasar, RyotaBannai and mmp3-montai
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statement