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(
518518 const auto &rule = getRule (pair.first );
519519 auto *proto = rule.getLHS ().back ().getProtocol ();
520520
521- MutableTerm baseTerm (rule.getLHS ());
521+ MutableTerm baseTerm (rule.getRHS ());
522522 (void ) simplify (baseTerm);
523523
524524 for (const auto &path : pair.second ) {
@@ -541,8 +541,23 @@ void RewriteSystem::verifyGeneratingConformanceEquations(
541541 }
542542
543543 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 ());
546561 }
547562
548563 (void ) simplify (otherTerm);
You can’t perform that action at this time.
0 commit comments