fix(narrowing): propagate walrus narrowing from inside `and` expressions (closes #19430) by traveltamers · Pull Request #21147 · python/mypy
and others added 4 commits
April 2, 2026 12:17Add _collect_walrus_type_map to TypeChecker that recursively walks arbitrary expression trees collecting AssignmentExpr type narrowings. Call it in find_isinstance_check_helper's "and" branch to register walrus assignments from the right operand into the true-branch type map.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters