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
It looks like reveal_type() doesn't work in "unreachable" branches, ie places where assert_never() passes.
To Reproduce
fromtypingimportassert_never, reveal_typedeffoo(b: bool):
reveal_type(b)
matchb:
caseTrue:
reveal_type(b)
print("True")
caseFalse:
reveal_type(b)
print("False")
case _:
assert_never(b)
reveal_type(b) # this one does not print
❯ mypy thing.py
thing.py:5: note: Revealed type is "builtins.bool"
thing.py:8: note: Revealed type is "Literal[True]"
thing.py:11: note: Revealed type is "Literal[False]"
Success: no issues found in 1 source file
Expected behaviour
I would expect the 4th reveal_type() to print something like Revealed type is Never ?
(note that the assert_never() does "pass").
Your Environment
mypy 1.14.1 (compiled: yes)
Python 3.13.0 (also seen in 3.12)
The text was updated successfully, but these errors were encountered:
Bug Report
It looks like
reveal_type()
doesn't work in "unreachable" branches, ie places whereassert_never()
passes.To Reproduce
(also at https://mypy-play.net/?mypy=latest&python=3.12&gist=d2646350c3ec4aa892763cdda7d32201)
Actual Behavior
Expected behaviour
I would expect the 4th
reveal_type()
to print something likeRevealed type is Never
?(note that the
assert_never()
does "pass").Your Environment
mypy 1.14.1 (compiled: yes)
Python 3.13.0 (also seen in 3.12)
The text was updated successfully, but these errors were encountered: