-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Closed as not planned
Copy link
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statement
Description
Bug Report
In a match statement, mypy complains that a case block binds different names in alternative patterns, but this is not the case.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.10&gist=68e7e816223c64a1e05a12d5935930c1
subject = ""
match subject:
case [str(s)] | str(s):
pass
Expected Behavior
Mypy finds no errors since each alternative pattern binds the same variable (s
).
Actual Behavior
main.py:4: error: Alternative patterns bind different names
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.981
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.10
Hnasar and arcan1s
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statement