mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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.
This commit is contained in:
@@ -1431,6 +1431,9 @@ ConstraintSystem::selectDisjunction() {
|
||||
unsigned firstActive = first->countActiveNestedConstraints();
|
||||
unsigned secondActive = second->countActiveNestedConstraints();
|
||||
|
||||
if (firstActive == 1 || secondActive == 1)
|
||||
return secondActive != 1;
|
||||
|
||||
auto &[firstScore, firstFavoredChoices] = favorings[first];
|
||||
auto &[secondScore, secondFavoredChoices] = favorings[second];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user