Skip to content

Commit 93eb22b

Browse files
committed
do not short-circuit overload resolution if chosen overload has async/sync mismatch
This fixes SR-13760 / rdar://70543421
1 parent 290923c commit 93eb22b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Sema/CSStep.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,15 @@ bool DisjunctionStep::shouldStopAt(const DisjunctionChoice &choice) const {
578578
auto delta = LastSolvedChoice->second - getCurrentScore();
579579
bool hasUnavailableOverloads = delta.Data[SK_Unavailable] > 0;
580580
bool hasFixes = delta.Data[SK_Fix] > 0;
581+
bool hasAsyncMismatch = delta.Data[SK_AsyncSyncMismatch] > 0;
581582
auto isBeginningOfPartition = choice.isBeginningOfPartition();
582583

583584
// Attempt to short-circuit evaluation of this disjunction only
584-
// if the disjunction choice we are comparing to did not involve
585-
// selecting unavailable overloads or result in fixes being
586-
// applied to reach a solution.
587-
return !hasUnavailableOverloads && !hasFixes &&
585+
// if the disjunction choice we are comparing to did not involve:
586+
// 1. selecting unavailable overloads
587+
// 2. result in fixes being applied to reach a solution
588+
// 3. selecting an overload that results in an async/sync mismatch
589+
return !hasUnavailableOverloads && !hasFixes && !hasAsyncMismatch &&
588590
(isBeginningOfPartition ||
589591
shortCircuitDisjunctionAt(choice, lastChoice));
590592
}

0 commit comments

Comments
 (0)