@@ -210,10 +210,9 @@ class IsolationRestriction {
210
210
// / Access to the declaration is unsafe in a concurrent context.
211
211
Unsafe,
212
212
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,
217
216
218
217
// / References to this local variable that can only be made from the
219
218
// / References to this member of an actor are only permitted on 'self'.
@@ -238,7 +237,7 @@ class IsolationRestriction {
238
237
// / class that is isolated to the current actor instance.
239
238
// /
240
239
// / \returns the type of the actor.
241
- static ClassDecl *getActorIsolatingInstanceMEmber (ValueDecl *value) {
240
+ static ClassDecl *getActorIsolatingInstanceMember (ValueDecl *value) {
242
241
// Only instance members are isolated.
243
242
if (!value->isInstanceMember ())
244
243
return nullptr ;
@@ -263,7 +262,7 @@ class IsolationRestriction {
263
262
264
263
// / Retrieve the declaration context in which a local was defined.
265
264
DeclContext *getLocalContext () const {
266
- assert (kind == Local );
265
+ assert (kind == LocalCapture );
267
266
return data.localContext ;
268
267
}
269
268
@@ -292,8 +291,8 @@ class IsolationRestriction {
292
291
}
293
292
294
293
// / 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 );
297
296
result.data .localContext = dc;
298
297
return result;
299
298
}
@@ -352,10 +351,10 @@ class IsolationRestriction {
352
351
// Local captures can only be referenced in their local context or a
353
352
// context that is guaranteed not to run concurrently with it.
354
353
if (cast<ValueDecl>(decl)->isLocalCapture ())
355
- return forLocal (decl->getDeclContext ());
354
+ return forLocalCapture (decl->getDeclContext ());
356
355
357
356
// Protected actor instance members can only be accessed on 'self'.
358
- if (auto actorClass = getActorIsolatingInstanceMEmber (
357
+ if (auto actorClass = getActorIsolatingInstanceMember (
359
358
cast<ValueDecl>(decl)))
360
359
return forActorSelf (actorClass);
361
360
@@ -541,7 +540,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
541
540
case IsolationRestriction::ActorSelf:
542
541
llvm_unreachable (" non-member reference into an actor" );
543
542
544
- case IsolationRestriction::Local :
543
+ case IsolationRestriction::LocalCapture :
545
544
// Only diagnose unsafe concurrent accesses within the context of an
546
545
// actor. This is globally unsafe, but locally enforceable.
547
546
if (!getNearestEnclosingActorContext (getDeclContext ()))
@@ -604,7 +603,7 @@ void swift::checkActorIsolation(const Expr *expr, const DeclContext *dc) {
604
603
return false ;
605
604
}
606
605
607
- case IsolationRestriction::Local :
606
+ case IsolationRestriction::LocalCapture :
608
607
llvm_unreachable (" Locals cannot be referenced with member syntax" );
609
608
610
609
case IsolationRestriction::Unsafe:
0 commit comments