@@ -210,10 +210,9 @@ class IsolationRestriction {
210210 // / Access to the declaration is unsafe in a concurrent context.
211211 Unsafe,
212212
213- // / The declaration can only be referenced from the given local context,
214- // / or a context that cannot execute concurrently with code in that
215- // / context.
216- Local,
213+ // / The declaration is a local entity whose capture could introduce
214+ // / data races. The context in which the local was defined is provided.
215+ LocalCapture,
217216
218217 // / References to this local variable that can only be made from the
219218 // / References to this member of an actor are only permitted on 'self'.
@@ -238,7 +237,7 @@ class IsolationRestriction {
238237 // / class that is isolated to the current actor instance.
239238 // /
240239 // / \returns the type of the actor.
241- static ClassDecl *getActorIsolatingInstanceMEmber (ValueDecl *value) {
240+ static ClassDecl *getActorIsolatingInstanceMember (ValueDecl *value) {
242241 // Only instance members are isolated.
243242 if (!value->isInstanceMember ())
244243 return nullptr ;
@@ -263,7 +262,7 @@ class IsolationRestriction {
263262
264263 // / Retrieve the declaration context in which a local was defined.
265264 DeclContext *getLocalContext () const {
266- assert (kind == Local );
265+ assert (kind == LocalCapture );
267266 return data.localContext ;
268267 }
269268
@@ -292,8 +291,8 @@ class IsolationRestriction {
292291 }
293292
294293 // / Access is restricted to code running within the given local context.
295- static IsolationRestriction forLocal (DeclContext *dc) {
296- IsolationRestriction result (Local );
294+ static IsolationRestriction forLocalCapture (DeclContext *dc) {
295+ IsolationRestriction result (LocalCapture );
297296 result.data .localContext = dc;
298297 return result;
299298 }
@@ -352,10 +351,10 @@ class IsolationRestriction {
352351 // Local captures can only be referenced in their local context or a
353352 // context that is guaranteed not to run concurrently with it.
354353 if (cast<ValueDecl>(decl)->isLocalCapture ())
355- return forLocal (decl->getDeclContext ());
354+ return forLocalCapture (decl->getDeclContext ());
356355
357356 // Protected actor instance members can only be accessed on 'self'.
358- if (auto actorClass = getActorIsolatingInstanceMEmber (
357+ if (auto actorClass = getActorIsolatingInstanceMember (
359358 cast<ValueDecl>(decl)))
360359 return forActorSelf (actorClass);
361360
@@ -541,7 +540,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
541540 case IsolationRestriction::ActorSelf:
542541 llvm_unreachable (" non-member reference into an actor" );
543542
544- case IsolationRestriction::Local :
543+ case IsolationRestriction::LocalCapture :
545544 // Only diagnose unsafe concurrent accesses within the context of an
546545 // actor. This is globally unsafe, but locally enforceable.
547546 if (!getNearestEnclosingActorContext (getDeclContext ()))
@@ -604,7 +603,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
604603 return false ;
605604 }
606605
607- case IsolationRestriction::Local :
606+ case IsolationRestriction::LocalCapture :
608607 llvm_unreachable (" Locals cannot be referenced with member syntax" );
609608
610609 case IsolationRestriction::Unsafe:
0 commit comments