@@ -216,6 +216,7 @@ class ConstraintGraphNode {
216216 friend class ConstraintGraph ;
217217 friend class ConstraintSystem ;
218218 friend class TypeVariableBinding ;
219+ friend class SolverTrail ;
219220};
220221
221222// / A graph that describes the relationships among the various type variables
@@ -387,7 +388,6 @@ class ConstraintGraph {
387388 // / Print the graph.
388389 void print (ArrayRef<TypeVariableType *> typeVars, llvm::raw_ostream &out);
389390 void dump (llvm::raw_ostream &out);
390- void dumpActiveScopeChanges (llvm::raw_ostream &out, unsigned indent = 0 );
391391
392392 // FIXME: Potentially side-effectful.
393393 SWIFT_DEBUG_HELPER (void dump ());
@@ -440,86 +440,12 @@ class ConstraintGraph {
440440 // / to contract constraint graph edges.
441441 void incrementConstraintsPerContractionCounter ();
442442
443- // / The kind of change made to the graph.
444- enum class ChangeKind {
445- // / Added a type variable.
446- AddedTypeVariable,
447- // / Added a new constraint.
448- AddedConstraint,
449- // / Removed an existing constraint
450- RemovedConstraint,
451- // / Extended the equivalence class of a type variable.
452- ExtendedEquivalenceClass,
453- // / Added a fixed binding for a type variable.
454- BoundTypeVariable,
455- };
456-
457- // / A change made to the constraint graph.
458- // /
459- // / Each change can be undone (once, and in reverse order) by calling the
460- // / undo() method.
461- class Change {
462- public:
463- // / The kind of change.
464- ChangeKind Kind;
465-
466- union {
467- TypeVariableType *TypeVar;
468- Constraint *TheConstraint;
469-
470- struct {
471- // / The type variable whose equivalence class was extended.
472- TypeVariableType *TypeVar;
473-
474- // / The previous size of the equivalence class.
475- unsigned PrevSize;
476- } EquivClass;
477-
478- struct {
479- // / The type variable being bound to a fixed type.
480- TypeVariableType *TypeVar;
481-
482- // / The fixed type to which the type variable was bound.
483- TypeBase *FixedType;
484- } Binding;
485- };
486-
487- Change () : Kind(ChangeKind::AddedTypeVariable), TypeVar(nullptr ) { }
488-
489- // / Create a change that added a type variable.
490- static Change addedTypeVariable (TypeVariableType *typeVar);
491-
492- // / Create a change that added a constraint.
493- static Change addedConstraint (Constraint *constraint);
494-
495- // / Create a change that removed a constraint.
496- static Change removedConstraint (Constraint *constraint);
497-
498- // / Create a change that extended an equivalence class.
499- static Change extendedEquivalenceClass (TypeVariableType *typeVar,
500- unsigned prevSize);
501-
502- // / Create a change that bound a type variable to a fixed type.
503- static Change boundTypeVariable (TypeVariableType *typeVar, Type fixed);
504-
505- // / Undo this change, reverting the constraint graph to the state it
506- // / had prior to this change.
507- // /
508- // / Changes must be undone in stack order.
509- void undo (ConstraintGraph &cg);
510- };
511-
512443 // / The currently active scope, or null if we aren't tracking changes made
513444 // / to the constraint graph.
514445 ConstraintGraphScope *ActiveScope = nullptr ;
515446
516- // / The set of changes made to this constraint graph.
517- // /
518- // / As the constraint graph is extended and mutated, additional changes are
519- // / introduced into this vector. Each scope
520- llvm::SmallVector<Change, 4 > Changes;
521-
522447 friend class ConstraintGraphScope ;
448+ friend class SolverTrail ;
523449};
524450
525451} // end namespace constraints
0 commit comments