@@ -5219,22 +5219,29 @@ static bool checkSendableInstanceStorage(
5219
5219
5220
5220
// / Handle a stored property.
5221
5221
bool operator ()(VarDecl *property, Type propertyType) override {
5222
- // Classes with mutable properties are not Sendable.
5222
+ // Classes with mutable properties are not Sendable unless property is
5223
+ // actor-isolated
5223
5224
if (property->supportsMutation () && isa<ClassDecl>(nominal)) {
5224
- if (isImplicitSendableCheck (check)) {
5225
- invalid = true ;
5226
- return true ;
5227
- }
5225
+ ActorIsolation isolation = getActorIsolation (property);
5228
5226
5229
- auto behavior = SendableCheckContext (
5230
- dc, check).defaultDiagnosticBehavior ();
5231
- if (behavior != DiagnosticBehavior::Ignore) {
5232
- property->diagnose (diag::concurrent_value_class_mutable_property,
5233
- property->getName (), nominal)
5234
- .limitBehavior (behavior);
5227
+ if (isolation.getKind () == ActorIsolation::Kind::Nonisolated ||
5228
+ isolation.getKind () == ActorIsolation::Kind::Unspecified) {
5229
+ if (isImplicitSendableCheck (check)) {
5230
+ invalid = true ;
5231
+ return true ;
5232
+ }
5233
+
5234
+ auto behavior =
5235
+ SendableCheckContext (dc, check).defaultDiagnosticBehavior ();
5236
+ if (behavior != DiagnosticBehavior::Ignore) {
5237
+ property
5238
+ ->diagnose (diag::concurrent_value_class_mutable_property,
5239
+ property->getName (), nominal)
5240
+ .limitBehavior (behavior);
5241
+ }
5242
+ invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
5243
+ return true ;
5235
5244
}
5236
- invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
5237
- return true ;
5238
5245
}
5239
5246
5240
5247
// Check that the property type is Sendable.
0 commit comments