@@ -6748,11 +6748,16 @@ static bool checkSendableInstanceStorage(
67486748 if (property->supportsMutation () && isolation.isUnspecified ()) {
67496749 auto behavior =
67506750 SendableCheckContext (dc, check).defaultDiagnosticBehavior ();
6751+ // If Sendable came from a `@preconcurrency` protocol the error
6752+ // should be downgraded even with strict concurrency checking to
6753+ // allow clients time to address the new requirement.
6754+ auto preconcurrency =
6755+ check == SendableCheck::ImpliedByPreconcurrencyProtocol;
67516756 if (behavior != DiagnosticBehavior::Ignore) {
67526757 property
67536758 ->diagnose (diag::concurrent_value_class_mutable_property,
67546759 property->getName (), nominal)
6755- .limitBehaviorUntilSwiftVersion (behavior, 6 );
6760+ .limitBehaviorWithPreconcurrency (behavior, preconcurrency );
67566761 }
67576762 invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
67586763 return true ;
@@ -6778,7 +6783,7 @@ static bool checkSendableInstanceStorage(
67786783 memberType, context,
67796784 /* inDerivedConformance*/ Type (), member->getLoc (),
67806785 [&](Type type, DiagnosticBehavior behavior) {
6781- auto preconcurrency = context.preconcurrencyBehavior (type);
6786+ auto preconcurrencyBehavior = context.preconcurrencyBehavior (type);
67826787 if (isImplicitSendableCheck (check)) {
67836788 // If this is for an externally-visible conformance, fail.
67846789 if (check == SendableCheck::ImplicitForExternallyVisible) {
@@ -6788,22 +6793,29 @@ static bool checkSendableInstanceStorage(
67886793
67896794 // If we are to ignore this diagnostic, just continue.
67906795 if (behavior == DiagnosticBehavior::Ignore ||
6791- preconcurrency == DiagnosticBehavior::Ignore)
6796+ preconcurrencyBehavior == DiagnosticBehavior::Ignore)
67926797 return true ;
67936798
67946799 invalid = true ;
67956800 return true ;
67966801 }
67976802
6798- if (preconcurrency)
6799- behavior = preconcurrency.value ();
6803+ // If Sendable came from a `@preconcurrency` protocol the error
6804+ // should be downgraded even with strict concurrency checking to
6805+ // allow clients time to address the new requirement.
6806+ bool fromPreconcurrencyConformance =
6807+ check == SendableCheck::ImpliedByPreconcurrencyProtocol;
6808+
6809+ if (preconcurrencyBehavior)
6810+ behavior = preconcurrencyBehavior.value ();
68006811
68016812 member
68026813 ->diagnose (diag::non_concurrent_type_member, type,
68036814 isa<EnumElementDecl>(member), member->getName (),
68046815 nominal)
6805- .limitBehaviorWithPreconcurrency (behavior,
6806- preconcurrency.has_value ());
6816+ .limitBehaviorWithPreconcurrency (
6817+ behavior, fromPreconcurrencyConformance ||
6818+ preconcurrencyBehavior.has_value ());
68076819 return false ;
68086820 });
68096821
0 commit comments