Skip to content

Commit ceae9fd

Browse files
authored
Merge pull request #59854 from amritpan/improve-ast-printing
[ConstraintSystem] Improve ast printing in the type inference algorithm debug output
2 parents f8c608a + 482db15 commit ceae9fd

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,15 +2009,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
20092009
<< E->getDecls()[0]->getBaseName();
20102010
PrintWithColorRAII(OS, ExprModifierColor)
20112011
<< " number_of_decls=" << E->getDecls().size()
2012-
<< " function_ref=" << getFunctionRefKindStr(E->getFunctionRefKind())
2013-
<< " decls=[\n";
2014-
interleave(E->getDecls(),
2015-
[&](ValueDecl *D) {
2016-
OS.indent(Indent + 2);
2017-
D->dumpRef(PrintWithColorRAII(OS, DeclModifierColor).getOS());
2018-
},
2019-
[&] { PrintWithColorRAII(OS, DeclModifierColor) << ",\n"; });
2020-
PrintWithColorRAII(OS, ExprModifierColor) << "]";
2012+
<< " function_ref=" << getFunctionRefKindStr(E->getFunctionRefKind());
20212013
PrintWithColorRAII(OS, ParenthesisColor) << ')';
20222014
}
20232015
void visitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *E) {
@@ -2595,12 +2587,6 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
25952587
}
25962588
Indent -= 2;
25972589

2598-
// If we printed any args, then print the closing ')' on a new line,
2599-
// otherwise print inline with the '(argument_list'.
2600-
if (!argList->empty()) {
2601-
OS << '\n';
2602-
OS.indent(Indent);
2603-
}
26042590
PrintWithColorRAII(OS, ParenthesisColor) << ')';
26052591

26062592
if (indent)

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,7 @@ void ConstraintSystem::print(raw_ostream &out, Expr *E) const {
13861386
};
13871387

13881388
E->dump(out, getTypeOfExpr, getTypeOfTypeRepr, getTypeOfKeyPathComponent);
1389+
out << "\n";
13891390
}
13901391

13911392
void ConstraintSystem::print(raw_ostream &out) const {

0 commit comments

Comments
 (0)