@@ -2391,7 +2391,7 @@ class ConstraintSystem {
23912391
23922392 // / A mapping from constraint locators to the opened existential archetype
23932393 // / used for the 'self' of an existential type.
2394- llvm::SmallMapVector <ConstraintLocator *, OpenedArchetypeType *, 4 >
2394+ llvm::SmallDenseMap <ConstraintLocator *, OpenedArchetypeType *, 4 >
23952395 OpenedExistentialTypes;
23962396
23972397 llvm::SmallMapVector<PackExpansionType *, TypeVariableType *, 4 >
@@ -2883,9 +2883,6 @@ class ConstraintSystem {
28832883 // / FIXME: Remove this.
28842884 unsigned numFixes;
28852885
2886- // / The length of \c OpenedExistentialTypes.
2887- unsigned numOpenedExistentialTypes;
2888-
28892886 // / The length of \c OpenedPackExpansionsTypes.
28902887 unsigned numOpenedPackExpansionTypes;
28912888
@@ -3456,6 +3453,16 @@ class ConstraintSystem {
34563453 std::pair<Type, OpenedArchetypeType *> openExistentialType (
34573454 Type type, ConstraintLocator *locator);
34583455
3456+ // / Update OpenedExistentials and record a change in the trail.
3457+ void recordOpenedExistentialType (ConstraintLocator *locator,
3458+ OpenedArchetypeType *opened);
3459+
3460+ // / Undo the above change.
3461+ void removeOpenedExistentialType (ConstraintLocator *locator) {
3462+ bool erased = OpenedExistentialTypes.erase (locator);
3463+ ASSERT (erased);
3464+ }
3465+
34593466 // / Get the opened element generic environment for the given locator.
34603467 GenericEnvironment *getPackElementEnvironment (ConstraintLocator *locator,
34613468 CanType shapeClass);
0 commit comments