Skip to content

Commit e66afaa

Browse files
committed
Correct the root cause noted for the pinned chained comparison
1 parent 1d43719 commit e66afaa

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎test-data/unit/check-inference.test‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,8 +4312,9 @@ def check_comprehension(xs: List[int]) -> None:
43124312
reveal_type(woo) # N: Revealed type is "builtins.int | None"
43134313

43144314
def check_chained_comparison(a: int, b: int) -> None:
4315-
# The else branch should stay optional, and does not. Pre-existing: the
4316-
# operand is narrowed through collapse_walrus in comparison_type_narrowing_helper.
4315+
# The else branch should stay optional, and does not. Pre-existing: chain
4316+
# operands are checked in one binder frame, so the assignment is recorded
4317+
# even when short-circuiting means it never ran.
43174318
woo = None
43184319
if a < b < (woo := 5):
43194320
reveal_type(woo) # N: Revealed type is "builtins.int"

0 commit comments

Comments
 (0)