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
This happens because mypy does not execute code for Literal[False] branches in if.
Check this:
"""All three of these assert_type should fail, but only one does, currently."""importtyping_extensionsastdeff(x: int|bool):
ifisinstance(x, str):
reveal_type(x) # not executed
Bug Report
In a case that mypy deems impossible (i.e. type narrowed to NoReturn), it's currently impossible to cause
assert_type
to fail.Similarly,
reveal_type
has no effect in the case of NoReturn.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=10400960688da44ab22b58df6c297f50
Expected Behavior
Three assert_type failures.
Actual Behavior
Only one assert_type failure.
The text was updated successfully, but these errors were encountered: