Bug Report
--warn-unreachable causes mypy to interpret a lambda-expression-which-always-raises, passed into a callable, to be unreachable.
To Reproduce
from typing import NoReturn
def always_raises() -> NoReturn:
raise Exception
def accepts_anything(*args: object, **kwargs: object) -> None:
pass
accepts_anything(lambda: always_raises())
a: int = 3 # mypy: Statement is unreachable [unreachable]
Expected Behavior
No issues
Mypy Environment
Tested on the mypy-play.net playground:
- Mypy version used:
master and 0.981
- Mypy command-line flags:
--warn-unreachable
- Mypy configuration options from
mypy.ini (and other config files): None
- Python version used: 3.10
Bug Report
--warn-unreachablecauses mypy to interpret a lambda-expression-which-always-raises, passed into a callable, to be unreachable.To Reproduce
Expected Behavior
No issues
Mypy Environment
Tested on the
mypy-play.netplayground:masterand0.981--warn-unreachablemypy.ini(and other config files): None