@@ -6768,11 +6768,16 @@ static bool checkSendableInstanceStorage(
67686768 if (property->supportsMutation () && isolation.isUnspecified ()) {
67696769 auto behavior =
67706770 SendableCheckContext (dc, check).defaultDiagnosticBehavior ();
6771+ // If Sendable came from a `@preconcurrency` protocol the error
6772+ // should be downgraded even with strict concurrency checking to
6773+ // allow clients time to address the new requirement.
6774+ auto preconcurrency =
6775+ check == SendableCheck::ImpliedByPreconcurrencyProtocol;
67716776 if (behavior != DiagnosticBehavior::Ignore) {
67726777 property
67736778 ->diagnose (diag::concurrent_value_class_mutable_property,
67746779 property->getName (), nominal)
6775- .limitBehaviorUntilSwiftVersion (behavior, 6 );
6780+ .limitBehaviorWithPreconcurrency (behavior, preconcurrency );
67766781 }
67776782 invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
67786783 return true ;
@@ -6798,7 +6803,7 @@ static bool checkSendableInstanceStorage(
67986803 memberType, context,
67996804 /* inDerivedConformance*/ Type (), member->getLoc (),
68006805 [&](Type type, DiagnosticBehavior behavior) {
6801- auto preconcurrency = context.preconcurrencyBehavior (type);
6806+ auto preconcurrencyBehavior = context.preconcurrencyBehavior (type);
68026807 if (isImplicitSendableCheck (check)) {
68036808 // If this is for an externally-visible conformance, fail.
68046809 if (check == SendableCheck::ImplicitForExternallyVisible) {
@@ -6808,22 +6813,29 @@ static bool checkSendableInstanceStorage(
68086813
68096814 // If we are to ignore this diagnostic, just continue.
68106815 if (behavior == DiagnosticBehavior::Ignore ||
6811- preconcurrency == DiagnosticBehavior::Ignore)
6816+ preconcurrencyBehavior == DiagnosticBehavior::Ignore)
68126817 return true ;
68136818
68146819 invalid = true ;
68156820 return true ;
68166821 }
68176822
6818- if (preconcurrency)
6819- behavior = preconcurrency.value ();
6823+ // If Sendable came from a `@preconcurrency` protocol the error
6824+ // should be downgraded even with strict concurrency checking to
6825+ // allow clients time to address the new requirement.
6826+ bool fromPreconcurrencyConformance =
6827+ check == SendableCheck::ImpliedByPreconcurrencyProtocol;
6828+
6829+ if (preconcurrencyBehavior)
6830+ behavior = preconcurrencyBehavior.value ();
68206831
68216832 member
68226833 ->diagnose (diag::non_concurrent_type_member, type,
68236834 isa<EnumElementDecl>(member), member->getName (),
68246835 nominal)
6825- .limitBehaviorWithPreconcurrency (behavior,
6826- preconcurrency.has_value ());
6836+ .limitBehaviorWithPreconcurrency (
6837+ behavior, fromPreconcurrencyConformance ||
6838+ preconcurrencyBehavior.has_value ());
68276839 return false ;
68286840 });
68296841
0 commit comments