TypeGuard does not narrow when statement compares for identity (is True
)
#17483
Labels
bug
mypy got something wrong
topic-type-narrowing
Conditional type narrowing / binder
topic-typeguard
TypeGuard / PEP 647
Bug Report
In the example below
f
is aTypeGuard
that mypy fails to narrow the type with when the statement compares with identity (is True
)To Reproduce
https://mypy-play.net/?mypy=master&python=3.12&flags=strict&gist=688d7597c968ed90ecdd8d4bf2b3a8a3
Expected Behavior
Actual Behavior
Your Environment
1.10.1
(and master)mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: