You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/check-unreachable-code.test
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1494,3 +1494,23 @@ from typing import Generator
1494
1494
def f() -> Generator[None, None, None]:
1495
1495
return None
1496
1496
yield None
1497
+
1498
+
[case testLambdaNoReturn]
1499
+
# flags: --warn-unreachable
1500
+
from typing import Callable, NoReturn
1501
+
1502
+
def foo() -> NoReturn:
1503
+
raise
1504
+
1505
+
f = lambda: foo()
1506
+
x = 0 # not unreachable
1507
+
1508
+
[case testLambdaNoReturnAnnotated]
1509
+
# flags: --warn-unreachable
1510
+
from typing import Callable, NoReturn
1511
+
1512
+
def foo() -> NoReturn:
1513
+
raise
1514
+
1515
+
f: Callable[[], NoReturn] = lambda: foo() # E: Return statement in function which does not return # (false positive: https://github.com/python/mypy/issues/17254)
0 commit comments