@@ -2672,11 +2672,15 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
26722672 }
26732673
26742674 /// Whether to downgrade to a concurrency warning.
2675- auto isConcurrencyWarning = [&] {
2676- if (contextRequiresStrictConcurrencyChecking(DC, GetClosureType{*this})
2677- && !hasPreconcurrencyCallee(this, locator))
2675+ auto isConcurrencyWarning = [&](bool forSendable) {
2676+ // Except for Sendable warnings, don't downgrade to an error in strict
2677+ // contexts without a preconcurrency callee.
2678+ if (!forSendable &&
2679+ contextRequiresStrictConcurrencyChecking(DC, GetClosureType{*this}) &&
2680+ !hasPreconcurrencyCallee(this, locator))
26782681 return false;
26792682
2683+ // We can only handle the downgrade for conversions.
26802684 switch (kind) {
26812685 case ConstraintKind::Conversion:
26822686 case ConstraintKind::ArgumentConversion:
@@ -2696,7 +2700,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
26962700
26972701 auto *fix = AddSendableAttribute::create(
26982702 *this, func1, func2, getConstraintLocator(locator),
2699- isConcurrencyWarning());
2703+ isConcurrencyWarning(true ));
27002704 if (recordFix(fix))
27012705 return getTypeMatchFailure(locator);
27022706 }
@@ -2731,7 +2735,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
27312735
27322736 auto *fix = MarkGlobalActorFunction::create(
27332737 *this, func1, func2, getConstraintLocator(locator),
2734- isConcurrencyWarning());
2738+ isConcurrencyWarning(false ));
27352739
27362740 if (recordFix(fix))
27372741 return getTypeMatchFailure(locator);
0 commit comments