@@ -2252,35 +2252,12 @@ namespace {
2252
2252
}
2253
2253
}
2254
2254
2255
- // Cannot reference subscripts, or stored properties.
2256
- auto var = dyn_cast<VarDecl>(decl);
2257
- if (isa<SubscriptDecl>(decl) || var) {
2258
- // But computed distributed properties are okay,
2259
- // and treated the same as a distributed func.
2260
- if (var && var->isDistributed ()) {
2261
- bool explicitlyThrowing = false ;
2262
- if (auto getter = var->getAccessor (swift::AccessorKind::Get)) {
2263
- explicitlyThrowing = getter->hasThrows ();
2264
- }
2265
- return std::make_pair (
2266
- /* setThrows*/ !explicitlyThrowing,
2267
- /* isDistributedThunk=*/ true );
2268
- }
2269
-
2270
- // otherwise, it was a normal property or subscript and therefore illegal
2271
- ctx.Diags .diagnose (
2272
- declLoc, diag::distributed_actor_isolated_non_self_reference,
2273
- decl->getDescriptiveKind (), decl->getName ());
2274
- noteIsolatedActorMember (decl, context);
2275
- return None;
2276
- }
2277
-
2278
2255
// Check that we have a distributed function or computed property.
2279
2256
if (auto afd = dyn_cast<AbstractFunctionDecl>(decl)) {
2280
2257
if (!afd->isDistributed ()) {
2281
- ctx.Diags .diagnose (declLoc,
2282
- diag::distributed_actor_isolated_method)
2283
- . fixItInsert (decl-> getAttributeInsertionLoc ( true ), " distributed " );
2258
+ ctx.Diags .diagnose (declLoc, diag::distributed_actor_isolated_method)
2259
+ . fixItInsert (decl-> getAttributeInsertionLoc ( true ),
2260
+ " distributed " );
2284
2261
2285
2262
noteIsolatedActorMember (decl, context);
2286
2263
return None;
@@ -2291,7 +2268,24 @@ namespace {
2291
2268
/* isDistributedThunk=*/ true );
2292
2269
}
2293
2270
2294
- return std::make_pair (/* setThrows=*/ false , /* distributedThunk=*/ false );
2271
+ if (auto *var = dyn_cast<VarDecl>(decl)) {
2272
+ if (var->isDistributed ()) {
2273
+ bool explicitlyThrowing = false ;
2274
+ if (auto getter = var->getAccessor (swift::AccessorKind::Get)) {
2275
+ explicitlyThrowing = getter->hasThrows ();
2276
+ }
2277
+ return std::make_pair (
2278
+ /* setThrows*/ !explicitlyThrowing,
2279
+ /* isDistributedThunk=*/ true );
2280
+ }
2281
+ }
2282
+
2283
+ // This is either non-distributed variable, subscript, or something else.
2284
+ ctx.Diags .diagnose (declLoc,
2285
+ diag::distributed_actor_isolated_non_self_reference,
2286
+ decl->getDescriptiveKind (), decl->getName ());
2287
+ noteIsolatedActorMember (decl, context);
2288
+ return None;
2295
2289
}
2296
2290
2297
2291
// / Attempts to identify and mark a valid cross-actor use of a synchronous
0 commit comments