Bug Report
mypy does not check the code after the line with lambda function that calls NoReturn function
To Reproduce
Check the code below. I also attached a mypy Playground link.
from typing import NoReturn
def foo() -> NoReturn:
raise
f = lambda _: foo() # when this line is commented mypy works as expected
bar: int = "baz"
https://mypy-play.net/?mypy=latest&python=3.12&gist=a924d0f423440c8a1a48348f49edae4e
Expected Behavior
mypy checks the code after line with lambda function that calls NoReturn function, not only the code before that line
Actual Behavior
mypy does not check the code after the line with lambda function that calls NoReturn function
Environment
- Mypy version used: mypy 1.5.0-1.10.0
- Python version used: Python 3.11.2
Edit
I edited the used mypy version because I noticed the same bug in many versions.