Closed
Description
Bug Report
(Maybe related to #8766)
Consider the following code:
from typing import Iterator
def gen() -> Iterator[int]:
if 1 == 2:
yield 0
def test() -> None:
x = None
for x in gen():
pass
if x is None:
print('reachable')
To Reproduce
mypy above_file.py --warn-unreachable
Expected Behavior
No error.
Actual Behavior
tmp.py:14: error: Statement is unreachable
print('reachable')
^
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.931
- Mypy command-line flags: --warn-unreachable
- Python version used: Python 3.9.10
- Operating system and version: arch 5.17.1-arch1-1