File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -136,17 +136,30 @@ static std::optional<int> shortlexCompare(const Symbol *lhsBegin,
136136 RewriteContext &ctx) {
137137 // First, compare the number of name and pack element symbols.
138138 unsigned lhsNameCount = 0 ;
139+ unsigned lhsPackElementCount = 0 ;
139140 for (auto *iter = lhsBegin; iter != lhsEnd; ++iter) {
140141 if (iter->getKind () == Symbol::Kind::Name)
141142 ++lhsNameCount;
143+
144+ if (iter->getKind () == Symbol::Kind::PackElement)
145+ ++lhsPackElementCount;
142146 }
143147
144148 unsigned rhsNameCount = 0 ;
149+ unsigned rhsPackElementCount = 0 ;
145150 for (auto *iter = rhsBegin; iter != rhsEnd; ++iter) {
146151 if (iter->getKind () == Symbol::Kind::Name)
147152 ++rhsNameCount;
153+
154+ if (iter->getKind () == Symbol::Kind::PackElement)
155+ ++rhsPackElementCount;
148156 }
149157
158+ // A term with more pack element symbols orders after a term with
159+ // fewer pack element symbols.
160+ if (lhsPackElementCount != rhsPackElementCount)
161+ return lhsPackElementCount > rhsPackElementCount ? 1 : -1 ;
162+
150163 // A term with more name symbols orders after a term with fewer name symbols.
151164 if (lhsNameCount != rhsNameCount)
152165 return lhsNameCount > rhsNameCount ? 1 : -1 ;
You can’t perform that action at this time.
0 commit comments