Skip to content

Commit 4edbaa4

Browse files
authored
Merge pull request #61103 from amritpan/format-fixes
[ConstraintSystem] Format fixes to the type inference debug output.
2 parents 85a554a + a4a7207 commit 4edbaa4

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,8 +1656,6 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
16561656
PrintOptions PO;
16571657
PO.PrintTypesForDebugging = true;
16581658

1659-
out.indent(indent);
1660-
out << "(";
16611659
if (auto typeVar = getTypeVariable()) {
16621660
typeVar->print(out, PO);
16631661
out << " ";
@@ -1814,7 +1812,7 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
18141812
}
18151813
out << "]";
18161814
}
1817-
out << ")";
1815+
18181816
}
18191817

18201818
// Given a possibly-Optional type, return the direct superclass of the

lib/Sema/CSStep.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ StepResult ComponentStep::take(bool prevFailed) {
351351

352352
auto bestBindings = CS.determineBestBindings([&](const BindingSet &bindings) {
353353
if (CS.isDebugMode() && bindings.hasViableBindings()) {
354+
bos.indent(CS.solverState->getCurrentIndent() + 2);
355+
bos << "(";
354356
bindings.dump(bos, CS.solverState->getCurrentIndent() + 2);
355-
bos << "\n";
357+
bos << ")\n";
356358
}
357359
});
358360

lib/Sema/Constraint.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,14 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm, unsigned inden
388388

389389
interleave(sortedConstraints,
390390
[&](Constraint *constraint) {
391+
Out.indent(indent);
391392
if (constraint->isDisabled())
392393
Out << "> [disabled] ";
393394
else if (constraint->isFavored())
394395
Out << "> [favored] ";
395396
else
396397
Out << "> ";
397-
constraint->print(Out, sm,
398+
constraint->print(Out, sm, indent,
398399
/*skipLocator=*/constraint->getLocator() == Locator);
399400
},
400401
[&] { Out << "\n"; });

lib/Sema/ConstraintGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ void ConstraintGraph::dumpActiveScopeChanges(llvm::raw_ostream &out,
16511651
for (const auto &constraint : addedConstraints) {
16521652
out.indent(indent + 4);
16531653
out << "> ";
1654-
constraint->print(out, &CS.getASTContext().SourceMgr);
1654+
constraint->print(out, &CS.getASTContext().SourceMgr, indent + 6);
16551655
out << '\n';
16561656
}
16571657
out.indent(indent + 2);
@@ -1665,7 +1665,7 @@ void ConstraintGraph::dumpActiveScopeChanges(llvm::raw_ostream &out,
16651665
for (const auto &constraint : removedConstraints) {
16661666
out.indent(indent + 4);
16671667
out << "> ";
1668-
constraint->print(out, &CS.getASTContext().SourceMgr);
1668+
constraint->print(out, &CS.getASTContext().SourceMgr, indent + 6);
16691669
out << '\n';
16701670
}
16711671
out.indent(indent + 2);

0 commit comments

Comments
 (0)