--warn-unreachable
sometimes flags sys.version_info
checks as unreachable in class methods
#18417
Labels
--warn-unreachable
sometimes flags sys.version_info
checks as unreachable in class methods
#18417
When using a
sys.version_info
check inside a method or a function, the--warn-unreachable
flag will sometimes mark version checks that fail the current python version as unreachable.To Reproduce
See this example of running this snippet on the playground with python version 3.11 and then python version 3.10
Expected Behavior
mypy marks the branches with
sys.version_info
inside theless_than_check
andgreater_than_equal
that don't match the current version as unreachable. However, it does not mark the free-standingif sys.version_info < (3, 11):
andif sys.version_info >= (3, 11):
checks in the file as unreachable.I would expect that the class method and function checks should not get marked unreachable either.
Your Environment
--warn-unreachable
The text was updated successfully, but these errors were encountered: