-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
enhancement requestNew feature or requestNew feature or request
Description
(Acknowledging that this is a new and disabled-by-default rule)
Currently pyright will trigger reportUnreachable on the following code:
def foo(x: int | str):
if isinstance(x, int):
print("int")
elif isinstance(x, str):
print("str")
else:
raise ValueError # error
mypy's version of the same rule ignores unreachable statements that are of a small set of forms, like raise (expr) or assert False, or statements are equivalent to a correctly used assert_never: https://github.com/python/mypy/blob/master/mypy/checker.py#L3139-L3165
This makes these diagnostics substantially higher signal
travisdowns and AlexWaygood
Metadata
Metadata
Assignees
Labels
enhancement requestNew feature or requestNew feature or request