Skip to content

Commit 0e0b5f9

Browse files
committed
[CSOptimizer] Always prefer a disjunction with a single active choice
Disjunctions with a single element are sometimes introduced after disfavoring, so we need to make sure that they are always preferred during disjunction selection.
1 parent b96139e commit 0e0b5f9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Sema/CSOptimizer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,9 @@ ConstraintSystem::selectDisjunction() {
14311431
unsigned firstActive = first->countActiveNestedConstraints();
14321432
unsigned secondActive = second->countActiveNestedConstraints();
14331433

1434+
if (firstActive == 1 || secondActive == 1)
1435+
return secondActive != 1;
1436+
14341437
auto &[firstScore, firstFavoredChoices] = favorings[first];
14351438
auto &[secondScore, secondFavoredChoices] = favorings[second];
14361439

0 commit comments

Comments
 (0)