Skip to content

Commit 4345a04

Browse files
committed
Show witnesses in NormalProtocolConformance::dump.
(Actually ProtocolConformance::dump when 'this' is a NormalProtocolConformance.) No functionality change.
1 parent f4e2b53 commit 4345a04

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,6 +2743,35 @@ void ProtocolConformance::dump(llvm::raw_ostream &out, unsigned indent) const {
27432743

27442744
printCommon("normal");
27452745
// Maybe print information about the conforming context?
2746+
if (normal->isLazilyResolved()) {
2747+
out << " lazy";
2748+
} else {
2749+
forEachTypeWitness(nullptr, [&](const AssociatedTypeDecl *req,
2750+
Type ty, const TypeDecl *) -> bool {
2751+
out << '\n';
2752+
out.indent(indent + 2);
2753+
PrintWithColorRAII(out, ParenthesisColor) << '(';
2754+
out << "assoc_type req=" << req->getName() << " type=";
2755+
PrintWithColorRAII(out, TypeColor) << ty;
2756+
PrintWithColorRAII(out, ParenthesisColor) << ')';
2757+
return false;
2758+
});
2759+
normal->forEachValueWitness(nullptr, [&](const ValueDecl *req,
2760+
Witness witness) {
2761+
out << '\n';
2762+
out.indent(indent + 2);
2763+
PrintWithColorRAII(out, ParenthesisColor) << '(';
2764+
out << "value req=" << req->getFullName() << " witness=";
2765+
if (!witness) {
2766+
out << "(none)";
2767+
} else if (witness.getDecl() == req) {
2768+
out << "(dynamic)";
2769+
} else {
2770+
witness.getDecl()->dumpRef(out);
2771+
}
2772+
PrintWithColorRAII(out, ParenthesisColor) << ')';
2773+
});
2774+
}
27462775

27472776
for (auto conformance : normal->getSignatureConformances()) {
27482777
out << '\n';

0 commit comments

Comments
 (0)