@@ -5334,22 +5334,28 @@ static bool checkSendableInstanceStorage(
5334
5334
5335
5335
// / Handle a stored property.
5336
5336
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);
5341
5353
return true ;
5342
5354
}
5343
5355
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
5350
5358
}
5351
- invalid = invalid || (behavior == DiagnosticBehavior::Unspecified);
5352
- return true ;
5353
5359
}
5354
5360
5355
5361
// Check that the property type is Sendable.
0 commit comments