Skip to content

Commit a46a7b8

Browse files
committed
RequirementMachine: Check that homotopy reduction was able to eliminate all redundant conformances
1 parent 34592cb commit a46a7b8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/AST/RequirementMachine/HomotopyReduction.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,22 @@ void RewriteSystem::minimizeRewriteSystem() {
684684
else
685685
break;
686686
}
687+
688+
// Assert if homotopy reduction failed to eliminate a redundant conformance,
689+
// since this suggests a misunderstanding on my part.
690+
for (unsigned ruleID : redundantConformances) {
691+
const auto &rule = getRule(ruleID);
692+
assert(rule.isProtocolConformanceRule() &&
693+
"Redundant conformance is not a conformance rule?");
694+
695+
if (!rule.isRedundant()) {
696+
llvm::errs() << "Homotopy reduction did not eliminate redundant "
697+
<< "conformance?\n";
698+
llvm::errs() << "(#" << ruleID << ") " << rule << "\n\n";
699+
dump(llvm::errs());
700+
abort();
701+
}
702+
}
687703
}
688704

689705
/// Verify that each 3-cell is a valid loop around its basepoint.

0 commit comments

Comments
 (0)