Skip to content

Commit 3d5ca29

Browse files
committed
GSB: Dump conformance and same-type requirement sources in EquivalenceClass::dump()
1 parent 44dac01 commit 3d5ca29

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,37 +2157,40 @@ void EquivalenceClass::dump(llvm::raw_ostream &out,
21572157
}, [&]() {
21582158
out << ", ";
21592159
});
2160-
out << "\nConformances:";
2161-
interleave(conformsTo,
2162-
[&](const std::pair<
2163-
ProtocolDecl *,
2164-
std::vector<Constraint<ProtocolDecl *>>> &entry) {
2165-
out << entry.first->getNameStr();
2166-
},
2167-
[&] { out << ", "; });
2168-
out << "\nSame-type constraints:";
2169-
llvm::interleave(
2170-
sameTypeConstraints,
2171-
[&](const Constraint<Type> &constraint) {
2172-
out << "\n " << constraint.getSubjectDependentType({})
2173-
<< " == " << constraint.value;
2160+
out << "\n";
2161+
out << "Conformance constraints:\n";
2162+
for (auto entry : conformsTo) {
2163+
out << " " << entry.first->getNameStr() << "\n";
2164+
for (auto constraint : entry.second) {
2165+
constraint.source->dump(out, &builder->getASTContext().SourceMgr, 4);
2166+
if (constraint.source->isDerivedRequirement())
2167+
out << " [derived]";
2168+
out << "\n";
2169+
}
2170+
}
2171+
2172+
out << "Same-type constraints:\n";
2173+
for (auto constraint : sameTypeConstraints) {
2174+
out << " " << constraint.getSubjectDependentType({})
2175+
<< " == " << constraint.value << "\n";
2176+
constraint.source->dump(out, &builder->getASTContext().SourceMgr, 4);
2177+
if (constraint.source->isDerivedRequirement())
2178+
out << " [derived]";
2179+
out << "\n";
2180+
}
21742181

2175-
if (constraint.source->isDerivedRequirement())
2176-
out << " [derived]";
2177-
},
2178-
[&] { out << ", "; });
21792182
if (concreteType)
2180-
out << "\nConcrete type: " << concreteType.getString();
2183+
out << "Concrete type: " << concreteType.getString() << "\n";
21812184
if (superclass)
2182-
out << "\nSuperclass: " << superclass.getString();
2185+
out << "Superclass: " << superclass.getString() << "\n";
21832186
if (layout)
2184-
out << "\nLayout: " << layout.getString();
2187+
out << "Layout: " << layout.getString() << "\n";
21852188

21862189
if (!delayedRequirements.empty()) {
2187-
out << "\nDelayed requirements:";
2190+
out << "Delayed requirements:\n";
21882191
for (const auto &req : delayedRequirements) {
2189-
out << "\n ";
21902192
req.dump(out);
2193+
out << "\n";
21912194
}
21922195
}
21932196

0 commit comments

Comments
 (0)