Skip to content

Commit ac9c83e

Browse files
authored
[ty] Fix flaky tests on macos (#21524)
We're seeing flaky test failures on macos, which seems to be caused by different Salsa ID orderings on the different platforms. Constraint set BDDs order their internal nodes based on the Salsa IDs of the interned typevar structs, and we had some code that depended on variable ordering in an unexpected way. This patch definitely fixes the macos test failure on #21414, and hopefully fixes it on #21436, too.
1 parent 5dd5626 commit ac9c83e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/ty_python_semantic/src/types/constraints.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,10 @@ impl<'db> InteriorNode<'db> {
15241524
.exists_one_inner(db, bound_typevar, map, path)
15251525
})
15261526
.unwrap_or(Node::AlwaysFalse);
1527-
Node::new(db, self_constraint, if_true, if_false)
1527+
// NB: We cannot use `Node::new` here, because the recursive calls might introduce new
1528+
// derived constraints into the result, and those constraints might appear before this
1529+
// one in the BDD ordering.
1530+
Node::new_constraint(db, self_constraint).ite(db, if_true, if_false)
15281531
}
15291532
}
15301533
}

0 commit comments

Comments
 (0)