[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.
This commit is contained in:
Douglas Creager 2025-11-19 09:44:32 -05:00 committed by GitHub
parent 5dd56264fb
commit ac9c83e581
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -1524,7 +1524,10 @@ impl<'db> InteriorNode<'db> {
.exists_one_inner(db, bound_typevar, map, path)
})
.unwrap_or(Node::AlwaysFalse);
Node::new(db, self_constraint, if_true, if_false)
// NB: We cannot use `Node::new` here, because the recursive calls might introduce new
// derived constraints into the result, and those constraints might appear before this
// one in the BDD ordering.
Node::new_constraint(db, self_constraint).ite(db, if_true, if_false)
}
}
}