Skip to content

Commit 2ad4892

Browse files
author
Amritpan Kaur
committed
[CSStep] Remove extraneous ) printing after PotentialBindings/Disjunctions.
`debugLogger` moved into each if-block so it's indentation doesn't affect next `isDebugMode`.
1 parent bdcefba commit 2ad4892

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/Sema/CSStep.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,20 +358,19 @@ StepResult ComponentStep::take(bool prevFailed) {
358358
auto *disjunction = CS.selectDisjunction();
359359

360360
if (CS.isDebugMode()) {
361-
PrintOptions PO;
362-
PO.PrintTypesForDebugging = true;
363-
364-
auto &log = getDebugLogger();
365361
if (!potentialBindings.empty()) {
362+
auto &log = getDebugLogger();
366363
log << "(Potential Binding(s): " << '\n';
367364
log << potentialBindings;
368365
}
369-
log.indent(CS.solverState->getCurrentIndent());
370366

371367
SmallVector<Constraint *, 4> disjunctions;
372368
CS.collectDisjunctions(disjunctions);
373369
std::vector<std::string> choicesWithBindOverload;
374370
for (const auto &disjunction : disjunctions) {
371+
PrintOptions PO;
372+
PO.PrintTypesForDebugging = true;
373+
375374
bool isBindOverload = false;
376375
auto constraints = disjunction->getNestedConstraints();
377376
for (const auto &choice : constraints) {
@@ -383,12 +382,17 @@ StepResult ComponentStep::take(bool prevFailed) {
383382
constraints.front()->getFirstType()->getString(PO));
384383
}
385384
if (!choicesWithBindOverload.empty()) {
385+
auto &log = getDebugLogger();
386386
log.indent(2);
387387
log << "Disjunction(s) = [";
388388
interleave(choicesWithBindOverload, log, ", ");
389-
log << "]";
389+
log << "]\n";
390+
391+
if (!potentialBindings.empty() || !choicesWithBindOverload.empty()) {
392+
auto &log = getDebugLogger();
393+
log << ")\n";
394+
}
390395
}
391-
log << ")\n";
392396
}
393397

394398
if (CS.shouldAttemptFixes()) {
@@ -484,7 +488,7 @@ StepResult ComponentStep::take(bool prevFailed) {
484488

485489
Solutions.push_back(std::move(solution));
486490
return finalize(/*isSuccess=*/true);
487-
}
491+
}
488492

489493
StepResult ComponentStep::finalize(bool isSuccess) {
490494
// If this was a single component, there is nothing to be done,

0 commit comments

Comments
 (0)