Skip to content

Commit 732b98f

Browse files
committed
[ConstraintSystem] Fold some logic into the gatherConstraints predicate.
1 parent dd6f577 commit 732b98f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,19 +1532,15 @@ static Constraint *getUnboundBindOverloadDisjunction(TypeVariableType *tyvar,
15321532
cs.getConstraintGraph().gatherConstraints(
15331533
rep, disjunctions, ConstraintGraph::GatheringKind::EquivalenceClass,
15341534
[](Constraint *match) {
1535-
return match->getKind() == ConstraintKind::Disjunction;
1535+
return match->getKind() == ConstraintKind::Disjunction &&
1536+
match->getNestedConstraints().front()->getKind() ==
1537+
ConstraintKind::BindOverload;
15361538
});
15371539

15381540
if (disjunctions.empty())
15391541
return nullptr;
15401542

1541-
for (auto *disjunction : disjunctions) {
1542-
auto *first = disjunction->getNestedConstraints().front();
1543-
if (first->getKind() == ConstraintKind::BindOverload)
1544-
return disjunction;
1545-
}
1546-
1547-
return nullptr;
1543+
return disjunctions[0];
15481544
}
15491545

15501546
// Find a disjunction associated with an ApplicableFunction constraint

0 commit comments

Comments
 (0)