@@ -252,7 +252,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
252252
253253 void visitActorAttr (ActorAttr *attr);
254254 void visitDistributedActorAttr (DistributedActorAttr *attr);
255- void visitActorIndependentAttr (ActorIndependentAttr *attr);
256255 void visitDistributedActorIndependentAttr (DistributedActorIndependentAttr *attr);
257256 void visitGlobalActorAttr (GlobalActorAttr *attr);
258257 void visitAsyncAttr (AsyncAttr *attr);
@@ -5391,7 +5390,6 @@ void AttributeChecker::visitActorAttr(ActorAttr *attr) {
53915390 (void )classDecl->isActor ();
53925391}
53935392
5394-
53955393void AttributeChecker::visitDistributedActorAttr (DistributedActorAttr *attr) {
53965394 auto dc = D->getDeclContext ();
53975395
@@ -5441,66 +5439,18 @@ void AttributeChecker::visitDistributedActorAttr(DistributedActorAttr *attr) {
54415439 }
54425440}
54435441
5444- void AttributeChecker::visitActorIndependentAttr (ActorIndependentAttr *attr) {
5445- // @actorIndependent can be applied to global and static/class variables
5446- // that do not have storage.
5447- auto dc = D->getDeclContext ();
5448- if (auto var = dyn_cast<VarDecl>(D)) {
5449- // @actorIndependent is meaningless on a `let`.
5450- if (var->isLet ()) {
5451- diagnoseAndRemoveAttr (attr, diag::actorindependent_let);
5452- return ;
5453- }
5454-
5455- // @actorIndependent can not be applied to stored properties, unless if
5456- // the 'unsafe' option was specified
5457- if (var->hasStorage ()) {
5458- switch (attr->getKind ()) {
5459- case ActorIndependentKind::Safe:
5460- diagnoseAndRemoveAttr (attr, diag::actorindependent_mutable_storage);
5461- return ;
5462-
5463- case ActorIndependentKind::Unsafe:
5464- break ;
5465- }
5466- }
5467-
5468- // @actorIndependent can not be applied to local properties.
5469- if (dc->isLocalContext ()) {
5470- diagnoseAndRemoveAttr (attr, diag::actorindependent_local_var);
5471- return ;
5472- }
5473-
5474- // If this is a static or global variable, we're all set.
5475- if (dc->isModuleScopeContext () ||
5476- (dc->isTypeContext () && var->isStatic ())) {
5477- return ;
5478- }
5479- }
5480-
5481- if (auto VD = dyn_cast<ValueDecl>(D)) {
5482- (void )getActorIsolation (VD);
5483- }
5484- }
5485-
54865442void AttributeChecker::visitNonisolatedAttr (NonisolatedAttr *attr) {
54875443 // 'nonisolated' can be applied to global and static/class variables
54885444 // that do not have storage.
54895445 auto dc = D->getDeclContext ();
54905446 if (auto var = dyn_cast<VarDecl>(D)) {
5491- // 'nonisolated' is meaningless on a `let`.
5492- if (var->isLet ()) {
5493- diagnoseAndRemoveAttr (attr, diag::nonisolated_let);
5494- return ;
5495- }
5496-
5497- // 'nonisolated' can not be applied to stored properties.
5498- if (var->hasStorage ()) {
5447+ // 'nonisolated' can not be applied to mutable stored properties.
5448+ if (var->hasStorage () && var->supportsMutation ()) {
54995449 diagnoseAndRemoveAttr (attr, diag::nonisolated_mutable_storage);
55005450 return ;
55015451 }
55025452
5503- // @actorIndependent can not be applied to local properties.
5453+ // nonisolated can not be applied to local properties.
55045454 if (dc->isLocalContext ()) {
55055455 diagnoseAndRemoveAttr (attr, diag::nonisolated_local_var);
55065456 return ;
@@ -5663,10 +5613,6 @@ class ClosureAttributeChecker
56635613 // Nothing else to check.
56645614 }
56655615
5666- void visitActorIndependentAttr (ActorIndependentAttr *attr) {
5667- // Nothing else to check.
5668- }
5669-
56705616 void visitCustomAttr (CustomAttr *attr) {
56715617 // Check whether this custom attribute is the global actor attribute.
56725618 auto globalActorAttr = evaluateOrDefault (
0 commit comments