-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-error-reportingHow we report errorsHow we report errorstopic-match-statementPython 3.10's match statementPython 3.10's match statement
Description
Bug Report
boiled down from code here
(A clear and concise description of what the bug is.)
To Reproduce
data = [100, 200, 300, 400]
match data:
case [*start, 400]:
print(f"Ends with 400, start: {start}")
case [100, *rest]:
print(f"Starts with 100, rest: {rest}")
config = {"host": "localhost", "port": 8080, "debug": True, "timeout": 30}
match config:
case {"host": h, "port": p, **rest}:
print(f"Server: {h}:{p}, other settings: {rest}")Expected Behavior
the error message should mention the line number (I believe 9 in this case)
Actual Behavior
$ mypy t.py
t.py: error: Incompatible types in capture pattern (pattern captures type "dict[str, object]", variable has type "list[int]") [misc]
Found 1 error in 1 file (checked 1 source file)Your Environment
- Mypy version used: 1.18.2
- Mypy command-line flags: n/a
- Mypy configuration options from
mypy.ini(and other config files): n/a - Python version used: 3.12.3
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-error-reportingHow we report errorsHow we report errorstopic-match-statementPython 3.10's match statementPython 3.10's match statement