@@ -6748,11 +6748,16 @@ static bool checkSendableInstanceStorage(
6748
6748
if (property->supportsMutation () && isolation.isUnspecified ()) {
6749
6749
auto behavior =
6750
6750
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;
6751
6756
if (behavior != DiagnosticBehavior::Ignore) {
6752
6757
property
6753
6758
->diagnose (diag::concurrent_value_class_mutable_property,
6754
6759
property->getName (), nominal)
6755
- .limitBehaviorUntilSwiftVersion (behavior, 6 );
6760
+ .limitBehaviorWithPreconcurrency (behavior, preconcurrency );
6756
6761
}
6757
6762
invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
6758
6763
return true ;
@@ -6778,7 +6783,7 @@ static bool checkSendableInstanceStorage(
6778
6783
memberType, context,
6779
6784
/* inDerivedConformance*/ Type (), member->getLoc (),
6780
6785
[&](Type type, DiagnosticBehavior behavior) {
6781
- auto preconcurrency = context.preconcurrencyBehavior (type);
6786
+ auto preconcurrencyBehavior = context.preconcurrencyBehavior (type);
6782
6787
if (isImplicitSendableCheck (check)) {
6783
6788
// If this is for an externally-visible conformance, fail.
6784
6789
if (check == SendableCheck::ImplicitForExternallyVisible) {
@@ -6788,22 +6793,29 @@ static bool checkSendableInstanceStorage(
6788
6793
6789
6794
// If we are to ignore this diagnostic, just continue.
6790
6795
if (behavior == DiagnosticBehavior::Ignore ||
6791
- preconcurrency == DiagnosticBehavior::Ignore)
6796
+ preconcurrencyBehavior == DiagnosticBehavior::Ignore)
6792
6797
return true ;
6793
6798
6794
6799
invalid = true ;
6795
6800
return true ;
6796
6801
}
6797
6802
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 ();
6800
6811
6801
6812
member
6802
6813
->diagnose (diag::non_concurrent_type_member, type,
6803
6814
isa<EnumElementDecl>(member), member->getName (),
6804
6815
nominal)
6805
- .limitBehaviorWithPreconcurrency (behavior,
6806
- preconcurrency.has_value ());
6816
+ .limitBehaviorWithPreconcurrency (
6817
+ behavior, fromPreconcurrencyConformance ||
6818
+ preconcurrencyBehavior.has_value ());
6807
6819
return false ;
6808
6820
});
6809
6821
0 commit comments