@@ -442,24 +442,15 @@ llvm::TinyPtrVector<Constraint *> ConstraintGraph::gatherConstraints(
442
442
llvm::function_ref<bool (Constraint *)> acceptConstraintFn) {
443
443
llvm::TinyPtrVector<Constraint *> constraints;
444
444
// Whether we should consider this constraint at all.
445
- auto rep = CS.getRepresentative (typeVar);
446
445
auto shouldConsiderConstraint = [&](Constraint *constraint) {
447
- // For a one-way constraint, only consider it when the type variable
448
- // is on the right-hand side of the the binding, and the left-hand side of
449
- // the binding is one of the type variables currently under consideration.
446
+ // For a one-way constraint, only consider it when the left-hand side of
447
+ // the binding is one of the type variables currently under consideration,
448
+ // as only such constraints need solving for this component. Note that we
449
+ // don't perform any other filtering, as the constraint system should be
450
+ // responsible for checking any other conditions.
450
451
if (constraint->isOneWayConstraint ()) {
451
- auto lhsTypeVar =
452
- constraint->getFirstType ()->castTo <TypeVariableType>();
453
- if (!CS.isActiveTypeVariable (lhsTypeVar))
454
- return false ;
455
-
456
- SmallVector<TypeVariableType *, 2 > rhsTypeVars;
457
- constraint->getSecondType ()->getTypeVariables (rhsTypeVars);
458
- for (auto rhsTypeVar : rhsTypeVars) {
459
- if (CS.getRepresentative (rhsTypeVar) == rep)
460
- return true ;
461
- }
462
- return false ;
452
+ auto lhsTypeVar = constraint->getFirstType ()->castTo <TypeVariableType>();
453
+ return CS.isActiveTypeVariable (lhsTypeVar);
463
454
}
464
455
465
456
return true ;
0 commit comments