Skip to content

Commit 760efca

Browse files
committed
RequirementMachine: When building a requirement signature system, remember the protocols
1 parent acb12fa commit 760efca

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/AST/RequirementMachine/RequirementMachine.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,18 @@ void RequirementMachine::verify(const MutableTerm &term) const {
333333
}
334334

335335
void RequirementMachine::dump(llvm::raw_ostream &out) const {
336-
out << "Requirement machine for " << Sig << "\n";
336+
out << "Requirement machine for ";
337+
if (Sig)
338+
out << Sig;
339+
else {
340+
out << "[";
341+
for (auto *proto : Protos) {
342+
out << " " << proto->getName();
343+
}
344+
out << " ]";
345+
}
346+
out << "\n";
347+
337348
System.dump(out);
338349
Map.dump(out);
339350

@@ -394,6 +405,8 @@ void RequirementMachine::initWithGenericSignature(CanGenericSignature sig) {
394405
}
395406

396407
void RequirementMachine::initWithProtocols(ArrayRef<const ProtocolDecl *> protos) {
408+
Protos = protos;
409+
397410
auto &ctx = Context.getASTContext();
398411
auto *Stats = ctx.Stats;
399412

lib/AST/RequirementMachine/RequirementMachine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class RequirementMachine final {
4848
friend class swift::rewriting::RewriteContext;
4949

5050
CanGenericSignature Sig;
51+
ArrayRef<const ProtocolDecl *> Protos;
5152

5253
RewriteContext &Context;
5354
RewriteSystem System;

0 commit comments

Comments
 (0)