Skip to content

Commit 119864a

Browse files
committed
[ConstraintSystem] Attempt global operators earlier.
When -Xfrontend -solver-enable-operator-designated-types is enabled, attempt operators defined outside of types before attempting operators defined within (non-designated) types. This helps fix some source compatability problems that arise from attempting some of the operators defined for Optional (e.g. we would sometimes typecheck successfully with the operator for Optional and then inject values into Optionals and skip attempting globally defined operators that also match). The old behavior resulted in failures in SourceKit and SIL Optimizer tests when enabling designated types by default in our test suite.
1 parent 9cf75f3 commit 119864a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,6 +1857,9 @@ void ConstraintSystem::partitionDisjunction(
18571857

18581858
partitionForDesignatedTypes(Choices, forEachChoice, appendPartition);
18591859

1860+
// Add all the things defined at global scope.
1861+
appendPartition(globalScope);
1862+
18601863
SmallVector<unsigned, 4> everythingElse;
18611864
// Gather the remaining options.
18621865
forEachChoice(Choices, [&](unsigned index, Constraint *constraint) -> bool {
@@ -1866,7 +1869,6 @@ void ConstraintSystem::partitionDisjunction(
18661869
appendPartition(everythingElse);
18671870

18681871
// Now create the remaining partitions from what we previously collected.
1869-
appendPartition(globalScope);
18701872
appendPartition(unavailable);
18711873
appendPartition(disabled);
18721874

0 commit comments

Comments
 (0)