@@ -2670,11 +2670,15 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
2670
2670
}
2671
2671
2672
2672
/// 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))
2676
2679
return false;
2677
2680
2681
+ // We can only handle the downgrade for conversions.
2678
2682
switch (kind) {
2679
2683
case ConstraintKind::Conversion:
2680
2684
case ConstraintKind::ArgumentConversion:
@@ -2694,7 +2698,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
2694
2698
2695
2699
auto *fix = AddSendableAttribute::create(
2696
2700
*this, func1, func2, getConstraintLocator(locator),
2697
- isConcurrencyWarning());
2701
+ isConcurrencyWarning(true ));
2698
2702
if (recordFix(fix))
2699
2703
return getTypeMatchFailure(locator);
2700
2704
}
@@ -2729,7 +2733,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
2729
2733
2730
2734
auto *fix = MarkGlobalActorFunction::create(
2731
2735
*this, func1, func2, getConstraintLocator(locator),
2732
- isConcurrencyWarning());
2736
+ isConcurrencyWarning(false ));
2733
2737
2734
2738
if (recordFix(fix))
2735
2739
return getTypeMatchFailure(locator);
0 commit comments