@@ -2302,35 +2302,12 @@ namespace {
2302
2302
}
2303
2303
}
2304
2304
2305
- // Cannot reference subscripts, or stored properties.
2306
- auto var = dyn_cast<VarDecl>(decl);
2307
- if (isa<SubscriptDecl>(decl) || var) {
2308
- // But computed distributed properties are okay,
2309
- // and treated the same as a distributed func.
2310
- if (var && var->isDistributed ()) {
2311
- bool explicitlyThrowing = false ;
2312
- if (auto getter = var->getAccessor (swift::AccessorKind::Get)) {
2313
- explicitlyThrowing = getter->hasThrows ();
2314
- }
2315
- return std::make_pair (
2316
- /* setThrows*/ !explicitlyThrowing,
2317
- /* isDistributedThunk=*/ true );
2318
- }
2319
-
2320
- // otherwise, it was a normal property or subscript and therefore illegal
2321
- ctx.Diags .diagnose (
2322
- declLoc, diag::distributed_actor_isolated_non_self_reference,
2323
- decl->getDescriptiveKind (), decl->getName ());
2324
- noteIsolatedActorMember (decl, context);
2325
- return None;
2326
- }
2327
-
2328
2305
// Check that we have a distributed function or computed property.
2329
2306
if (auto afd = dyn_cast<AbstractFunctionDecl>(decl)) {
2330
2307
if (!afd->isDistributed ()) {
2331
- ctx.Diags .diagnose (declLoc,
2332
- diag::distributed_actor_isolated_method)
2333
- . fixItInsert (decl-> getAttributeInsertionLoc ( true ), " distributed " );
2308
+ ctx.Diags .diagnose (declLoc, diag::distributed_actor_isolated_method)
2309
+ . fixItInsert (decl-> getAttributeInsertionLoc ( true ),
2310
+ " distributed " );
2334
2311
2335
2312
noteIsolatedActorMember (decl, context);
2336
2313
return None;
@@ -2341,7 +2318,24 @@ namespace {
2341
2318
/* isDistributedThunk=*/ true );
2342
2319
}
2343
2320
2344
- return std::make_pair (/* setThrows=*/ false , /* distributedThunk=*/ false );
2321
+ if (auto *var = dyn_cast<VarDecl>(decl)) {
2322
+ if (var->isDistributed ()) {
2323
+ bool explicitlyThrowing = false ;
2324
+ if (auto getter = var->getAccessor (swift::AccessorKind::Get)) {
2325
+ explicitlyThrowing = getter->hasThrows ();
2326
+ }
2327
+ return std::make_pair (
2328
+ /* setThrows*/ !explicitlyThrowing,
2329
+ /* isDistributedThunk=*/ true );
2330
+ }
2331
+ }
2332
+
2333
+ // This is either non-distributed variable, subscript, or something else.
2334
+ ctx.Diags .diagnose (declLoc,
2335
+ diag::distributed_actor_isolated_non_self_reference,
2336
+ decl->getDescriptiveKind (), decl->getName ());
2337
+ noteIsolatedActorMember (decl, context);
2338
+ return None;
2345
2339
}
2346
2340
2347
2341
// / Attempts to identify and mark a valid cross-actor use of a synchronous
0 commit comments