Type narrowing not performed in walrus operator conditional #19036
Labels
bug
mypy got something wrong
topic-pep-572
PEP 572 (walrus operator)
topic-type-narrowing
Conditional type narrowing / binder
Bug Report
Type narrowing is not performed in a conditional containing a walrus operator if:
if maybe and
), andfoo := Foo(True)).value
)To Reproduce
https://mypy-play.net/?mypy=latest&python=3.13&flags=strict&gist=7e7edfa1d3debec48847590a6c4532c9
Expected Behavior
The revealed type is always
Foo
.Actual Behavior
Your Environment
--strict
The text was updated successfully, but these errors were encountered: