Open
Description
Bug Report
Hello,
I want to do something like:
def match(info: RequestContext):
match info:
case RequestContext.ForPopup(data_only_in_popup_context=data):
print(data)
case RequestContext.ForDetailPage(data_only_in_detail_page=data):
print(data)
However I'm getting unreachable warnings when --warn-unreachable is turned on. But the code I have does indeed reach that line.
To Reproduce
https://gist.github.com/delfick/e7974027a422f8f212887e490e5d3a75
Expected Behavior
I expect no errors when running with mypy and the warn-unreachable option.
Actual Behavior
When I run python example.py
I get expected output
For popup <__main__.Request object at 0x10326a620> (1,) {'1': '2'}
For details page <__main__.Request object at 0x10326a0b0> {'3': '4'}
For popup {'1': '2'}
For details page {'3': '4'}
When I run mypy example.py --warn-unreachable
I get
example.py:49: error: Statement is unreachable [unreachable]
example.py:65: error: Statement is unreachable [unreachable]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.991
- Mypy command-line flags: --warn-unreachable
- Mypy configuration options from
mypy.ini
(and other config files): N/A - Python version used: 3.10.8