Skip to content

Commit 8176b61

Browse files
committed
RequirementMachine: Tweak debug output and add an assertion
1 parent 98beadf commit 8176b61

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/AST/RequirementMachine/ConcreteContraction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,12 @@ bool ConcreteContraction::performConcreteContraction(
531531
// Phase 2: Replace each concretely-conforming generic parameter with its
532532
// concrete type.
533533
for (auto req : requirements) {
534+
if (Debug) {
535+
llvm::dbgs() << "@ Original requirement: ";
536+
req.req.dump(llvm::dbgs());
537+
llvm::dbgs() << "\n";
538+
}
539+
534540
// Substitute the requirement.
535541
Optional<Requirement> substReq = substRequirement(req.req);
536542

lib/AST/RequirementMachine/ConcreteTypeWitness.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ void PropertyMap::concretizeTypeWitnessInConformance(
200200
AssociatedTypeDecl *assocType) const {
201201
auto concreteType = concreteConformanceSymbol.getConcreteType();
202202
auto substitutions = concreteConformanceSymbol.getSubstitutions();
203-
auto *proto = concreteConformanceSymbol.getProtocol();
203+
204+
auto *proto = assocType->getProtocol();
205+
assert(proto == concreteConformanceSymbol.getProtocol());
204206

205207
if (Debug.contains(DebugFlags::ConcretizeNestedTypes)) {
206208
llvm::dbgs() << "^^ " << "Looking up type witness for "

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ void RuleBuilder::collectRulesFromReferencedProtocols() {
14161416
// if neccessary, which will cause us to re-enter into a new RuleBuilder
14171417
// instace under RuleBuilder::initWithProtocolWrittenRequirements().
14181418
if (Dump) {
1419-
llvm::dbgs() << "importing protocol " << proto->getName() << " {\n";
1419+
llvm::dbgs() << "importing protocol " << proto->getName() << "\n";
14201420
}
14211421

14221422
auto *machine = Context.getRequirementMachine(proto);

0 commit comments

Comments
 (0)