Skip to content

Commit 6082d16

Browse files
authored
Merge pull request #60762 from amritpan/iterate-over-disjunction
[ConstraintSystem] Remove conjunction printing and iterate over all disjunction choices in scope
2 parents 891a44d + f683c2c commit 6082d16

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

lib/Sema/CSStep.cpp

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -356,34 +356,38 @@ StepResult ComponentStep::take(bool prevFailed) {
356356
});
357357

358358
auto *disjunction = CS.selectDisjunction();
359-
auto *conjunction = CS.selectConjunction();
360359

361360
if (CS.isDebugMode()) {
362-
PrintOptions PO;
363-
PO.PrintTypesForDebugging = true;
364-
365-
auto &log = getDebugLogger();
366361
if (!potentialBindings.empty()) {
362+
auto &log = getDebugLogger();
367363
log << "(Potential Binding(s): " << '\n';
368364
log << potentialBindings;
369365
}
370-
log.indent(CS.solverState->getCurrentIndent());
371366

372-
if (disjunction) {
373-
log.indent(2);
374-
log << "Disjunction(s) = [";
367+
SmallVector<Constraint *, 4> disjunctions;
368+
CS.collectDisjunctions(disjunctions);
369+
std::vector<std::string> overloadDisjunctions;
370+
for (const auto &disjunction : disjunctions) {
371+
PrintOptions PO;
372+
PO.PrintTypesForDebugging = true;
373+
375374
auto constraints = disjunction->getNestedConstraints();
376-
log << constraints[0]->getFirstType()->getString(PO);
377-
log << "]";
375+
if (constraints[0]->getKind() == ConstraintKind::BindOverload)
376+
overloadDisjunctions.push_back(
377+
constraints[0]->getFirstType()->getString(PO));
378378
}
379-
if (conjunction) {
379+
if (!overloadDisjunctions.empty()) {
380+
auto &log = getDebugLogger();
380381
log.indent(2);
381-
log << "Conjunction(s) = [";
382-
auto constraints = conjunction->getNestedConstraints();
383-
log << constraints[0]->getFirstType()->getString(PO);
384-
log << "]";
382+
log << "Disjunction(s) = [";
383+
interleave(overloadDisjunctions, log, ", ");
384+
log << "]\n";
385+
386+
if (!potentialBindings.empty() || !overloadDisjunctions.empty()) {
387+
auto &log = getDebugLogger();
388+
log << ")\n";
389+
}
385390
}
386-
log << ")\n";
387391
}
388392

389393
if (CS.shouldAttemptFixes()) {

0 commit comments

Comments
 (0)