File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ void RewriteSystem::verifyGeneratingConformanceEquations(
518
518
const auto &rule = getRule (pair.first );
519
519
auto *proto = rule.getLHS ().back ().getProtocol ();
520
520
521
- MutableTerm baseTerm (rule.getLHS ());
521
+ MutableTerm baseTerm (rule.getRHS ());
522
522
(void ) simplify (baseTerm);
523
523
524
524
for (const auto &path : pair.second ) {
@@ -541,8 +541,23 @@ void RewriteSystem::verifyGeneratingConformanceEquations(
541
541
}
542
542
543
543
MutableTerm otherTerm;
544
- for (unsigned otherRuleID : path) {
545
- otherTerm.append (getRule (otherRuleID).getLHS ());
544
+ for (unsigned i : indices (path)) {
545
+ unsigned otherRuleID = path[i];
546
+ const auto &rule = getRule (otherRuleID);
547
+
548
+ bool isLastElement = (i == path.size () - 1 );
549
+ if ((isLastElement && !rule.isAnyConformanceRule ()) ||
550
+ (!isLastElement && !rule.isProtocolConformanceRule ())) {
551
+ llvm::errs () << " Equation term is not a conformance rule: " ;
552
+ dumpGeneratingConformanceEquation (llvm::errs (),
553
+ pair.first , pair.second );
554
+ llvm::errs () << " \n " ;
555
+ llvm::errs () << " Term: " << rule << " \n " ;
556
+ dump (llvm::errs ());
557
+ abort ();
558
+ }
559
+
560
+ otherTerm.append (rule.getRHS ());
546
561
}
547
562
548
563
(void ) simplify (otherTerm);
You can’t perform that action at this time.
0 commit comments