@@ -2670,11 +2670,15 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
26702670 }
26712671
26722672 /// Whether to downgrade to a concurrency warning.
2673- auto isConcurrencyWarning = [&] {
2674- if (contextRequiresStrictConcurrencyChecking(DC, GetClosureType{*this})
2675- && !hasPreconcurrencyCallee(this, locator))
2673+ auto isConcurrencyWarning = [&](bool forSendable) {
2674+ // Except for Sendable warnings, don't downgrade to an error in strict
2675+ // contexts without a preconcurrency callee.
2676+ if (!forSendable &&
2677+ contextRequiresStrictConcurrencyChecking(DC, GetClosureType{*this}) &&
2678+ !hasPreconcurrencyCallee(this, locator))
26762679 return false;
26772680
2681+ // We can only handle the downgrade for conversions.
26782682 switch (kind) {
26792683 case ConstraintKind::Conversion:
26802684 case ConstraintKind::ArgumentConversion:
@@ -2694,7 +2698,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
26942698
26952699 auto *fix = AddSendableAttribute::create(
26962700 *this, func1, func2, getConstraintLocator(locator),
2697- isConcurrencyWarning());
2701+ isConcurrencyWarning(true ));
26982702 if (recordFix(fix))
26992703 return getTypeMatchFailure(locator);
27002704 }
@@ -2729,7 +2733,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
27292733
27302734 auto *fix = MarkGlobalActorFunction::create(
27312735 *this, func1, func2, getConstraintLocator(locator),
2732- isConcurrencyWarning());
2736+ isConcurrencyWarning(false ));
27332737
27342738 if (recordFix(fix))
27352739 return getTypeMatchFailure(locator);
0 commit comments