Sema: Record opened existential types in the trail

This commit is contained in:
Slava Pestov
2024-10-01 14:20:27 -04:00
parent f963f36a16
commit 7d3350d0f2
5 changed files with 47 additions and 13 deletions

View File

@@ -185,6 +185,14 @@ SolverTrail::Change::recordedOpenedTypes(ConstraintLocator *locator) {
return result;
}
SolverTrail::Change
SolverTrail::Change::recordedOpenedExistentialType(ConstraintLocator *locator) {
Change result;
result.Kind = ChangeKind::RecordedOpenedExistentialType;
result.Locator = locator;
return result;
}
void SolverTrail::Change::undo(ConstraintSystem &cs) const {
auto &cg = cs.getConstraintGraph();
@@ -253,6 +261,10 @@ void SolverTrail::Change::undo(ConstraintSystem &cs) const {
case ChangeKind::RecordedOpenedTypes:
cs.removeOpenedType(Locator);
break;
case ChangeKind::RecordedOpenedExistentialType:
cs.removeOpenedExistentialType(Locator);
break;
}
}
@@ -388,6 +400,12 @@ void SolverTrail::Change::dump(llvm::raw_ostream &out,
Locator->dump(&cs.getASTContext().SourceMgr, out);
out << ")\n";
break;
case ChangeKind::RecordedOpenedExistentialType:
out << "(recorded opened existential type at ";
Locator->dump(&cs.getASTContext().SourceMgr, out);
out << ")\n";
break;
}
}