Merge pull request #77174 from slavapestov/fix-undo-order

Sema: Undo changes in chronological order in SolverTrail::undo()
This commit is contained in:
Slava Pestov
2024-11-20 08:00:53 -05:00
committed by GitHub
7 changed files with 115 additions and 81 deletions

View File

@@ -555,12 +555,7 @@ public:
/// \param trail The record of state changes.
void mergeEquivalenceClasses(TypeVariableType *other,
constraints::SolverTrail *trail) {
// Merge the equivalence classes corresponding to these two type
// variables. Always merge 'up' the constraint stack, because it is simpler.
if (getID() > other->getImpl().getID()) {
other->getImpl().mergeEquivalenceClasses(getTypeVariable(), trail);
return;
}
ASSERT(getID() < other->getImpl().getID());
auto otherRep = other->getImpl().getRepresentative(trail);
if (trail)