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