Closed
Description
Bug description
from typing import NoReturn
def fail() -> NoReturn:
...
def foo(l):
while True:
for i in l:
break
else:
continue
# or break
# or fail()
print(i)
this is the same issue as #5971, though it seems to have only been fixed for return
statements but not break
, continue
statements or function calls that return NoReturn
or Never
Configuration
No response
Command used
pylint test.py
Pylint output
************* Module test
test.py:8:14: W0631: Using possibly undefined loop variable 'i' (undefined-loop-variable)
Expected behavior
no error
Pylint version
pylint 2.14.5
astroid 2.11.7
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
No response