@@ -5334,22 +5334,28 @@ static bool checkSendableInstanceStorage(
53345334
53355335 // / Handle a stored property.
53365336 bool operator ()(VarDecl *property, Type propertyType) override {
5337- // Classes with mutable properties are not Sendable.
5338- if (property->supportsMutation () && isa<ClassDecl>(nominal)) {
5339- if (isImplicitSendableCheck (check)) {
5340- invalid = true ;
5337+ // Classes with mutable properties are Sendable if property is
5338+ // actor-isolated
5339+ if (isa<ClassDecl>(nominal)) {
5340+ ActorIsolation isolation = getActorIsolation (property);
5341+
5342+ if (property->supportsMutation () &&
5343+ (isolation.isNonisolated () || isolation.isUnspecified ())) {
5344+ auto behavior =
5345+ SendableCheckContext (dc, check).defaultDiagnosticBehavior ();
5346+ if (behavior != DiagnosticBehavior::Ignore) {
5347+ property
5348+ ->diagnose (diag::concurrent_value_class_mutable_property,
5349+ property->getName (), nominal)
5350+ .limitBehavior (behavior);
5351+ }
5352+ invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
53415353 return true ;
53425354 }
53435355
5344- auto behavior = SendableCheckContext (
5345- dc, check).defaultDiagnosticBehavior ();
5346- if (behavior != DiagnosticBehavior::Ignore) {
5347- property->diagnose (diag::concurrent_value_class_mutable_property,
5348- property->getName (), nominal)
5349- .limitBehavior (behavior);
5356+ if (!(isolation.isNonisolated () || isolation.isUnspecified ())) {
5357+ return false ; // skip sendable check on actor-isolated properties
53505358 }
5351- invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
5352- return true ;
53535359 }
53545360
53555361 // Check that the property type is Sendable.
0 commit comments