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
Activity
sobolevn commentedon Oct 24, 2023
This happens because mypy does not execute code for
Literal[False]branches inif.Check this:
sobolevn commentedon Oct 24, 2023
This does not look like a bug to me.