Skip to content

Commit 6685e55

Browse files
committed
RequirementMachine: Print loop numbers in RewriteSystem::dump()
1 parent fcd41a0 commit 6685e55

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

lib/AST/RequirementMachine/RewriteSystem.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -754,25 +754,32 @@ void RewriteSystem::dump(llvm::raw_ostream &out) const {
754754
out << "- " << rule << "\n";
755755
}
756756
out << "}\n";
757-
out << "Relations: {\n";
758-
for (const auto &relation : Relations) {
759-
out << "- " << relation.first << " =>> " << relation.second << "\n";
757+
if (!Relations.empty()) {
758+
out << "Relations: {\n";
759+
for (const auto &relation : Relations) {
760+
out << "- " << relation.first << " =>> " << relation.second << "\n";
761+
}
762+
out << "}\n";
760763
}
761-
out << "}\n";
762-
out << "Type differences: {\n";
763-
for (const auto &difference : Differences) {
764-
difference.dump(out);
765-
out << "\n";
764+
if (!Differences.empty()) {
765+
out << "Type differences: {\n";
766+
for (const auto &difference : Differences) {
767+
difference.dump(out);
768+
out << "\n";
769+
}
770+
out << "}\n";
766771
}
767-
out << "}\n";
768-
out << "Rewrite loops: {\n";
769-
for (const auto &loop : Loops) {
770-
if (loop.isDeleted())
771-
continue;
772-
773-
out << "- ";
774-
loop.dump(out, *this);
775-
out << "\n";
772+
if (!Loops.empty()) {
773+
out << "Rewrite loops: {\n";
774+
for (unsigned loopID : indices(Loops)) {
775+
const auto &loop = Loops[loopID];
776+
if (loop.isDeleted())
777+
continue;
778+
779+
out << "- (#" << loopID << ") ";
780+
loop.dump(out, *this);
781+
out << "\n";
782+
}
776783
}
777784
out << "}\n";
778785
}

test/Generics/unify_associated_types.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ struct MergeTest<G : P1a & P2a> {}
2626
// CHECK: - τ_0_0.[P1a:T].[P2] => τ_0_0.[P1a:T]
2727
// CHECK: - τ_0_0.[P1a:T].[P2:X] => τ_0_0.[P1a:T].[P1:X]
2828
// CHECK: }
29-
// CHECK: Rewrite loops: {
30-
// CHECK: }
3129
// CHECK: Property map: {
3230
// CHECK: τ_0_0 => { conforms_to: [P1a P2a] }
3331
// CHECK: τ_0_0.[P1a:T] => { conforms_to: [P1 P2] }

0 commit comments

Comments
 (0)