@@ -300,18 +300,25 @@ class ConstraintGraph {
300300 // / to a type variable.
301301 void introduceToInference (TypeVariableType *typeVar, Type fixedType);
302302
303- // / Gather constraints associated with all of the variables within the
304- // / same equivalence class as the given type variable, as well as its
305- // / immediate fixed bindings.
306- llvm::TinyPtrVector<Constraint *>
307- gatherAllConstraints (TypeVariableType *typeVar);
303+ // / Describes which constraints \c gatherConstraints should gather.
304+ enum class GatheringKind {
305+ // / Gather constraints associated with all of the variables within the
306+ // / same equivalence class as the given type variable, as well as its
307+ // / immediate fixed bindings.
308+ EquivalenceClass,
309+ // / Gather all constraints that mention this type variable or type variables
310+ // / that it is a fixed binding of. Unlike EquivalenceClass, this looks
311+ // / through transitive fixed bindings. This can be used to find all the
312+ // / constraints that may be affected when binding a type variable.
313+ AllMentions,
314+ };
308315
309- // / Gather all constraints that mention this type variable or type variables
310- // / that it is a fixed binding of. Unlike EquivalenceClass, this looks
311- // / through transitive fixed bindings. This can be used to find all the
312- // / constraints that may be affected when binding a type variable.
316+ // / Gather the set of constraints that involve the given type variable,
317+ // / i.e., those constraints that will be affected when the type variable
318+ // / gets merged or bound to a fixed type.
313319 llvm::TinyPtrVector<Constraint *>
314- gatherNearbyConstraints (TypeVariableType *typeVar,
320+ gatherConstraints (TypeVariableType *typeVar,
321+ GatheringKind kind,
315322 llvm::function_ref<bool (Constraint *)> acceptConstraint =
316323 [](Constraint *constraint) { return true ; });
317324
@@ -336,6 +343,12 @@ class ConstraintGraph {
336343 // / The constraints in this component.
337344 TinyPtrVector<Constraint *> constraints;
338345
346+ // / The set of components that this component depends on, such that
347+ // / the partial solutions of the those components need to be available
348+ // / before this component can be solved.
349+ // /
350+ SmallVector<unsigned , 2 > dependencies;
351+
339352 public:
340353 Component (unsigned solutionIndex) : solutionIndex(solutionIndex) { }
341354
@@ -351,6 +364,11 @@ class ConstraintGraph {
351364 return constraints;
352365 }
353366
367+ // / Records a component which this component depends on.
368+ void recordDependency (const Component &component);
369+
370+ ArrayRef<unsigned > getDependencies () const { return dependencies; }
371+
354372 unsigned getNumDisjunctions () const { return numDisjunctions; }
355373 };
356374
0 commit comments