@@ -4933,10 +4933,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
49334933 // return caller isolation inheriting.
49344934 if (decl->getASTContext ().LangOpts .hasFeature (
49354935 Feature::NonisolatedNonsendingByDefault)) {
4936- if (auto *func = dyn_cast<AbstractFunctionDecl>(decl);
4937- func && func->hasAsync () &&
4938- func->getModuleContext () == decl->getASTContext ().MainModule ) {
4939- return ActorIsolation::forCallerIsolationInheriting ();
4936+ if (auto *value = dyn_cast<ValueDecl>(decl)) {
4937+ if (value->isAsync () &&
4938+ value->getModuleContext () == decl->getASTContext ().MainModule ) {
4939+ return ActorIsolation::forCallerIsolationInheriting ();
4940+ }
49404941 }
49414942 }
49424943
@@ -5795,11 +5796,9 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
57955796 return *result;
57965797 }
57975798
5798- // If we have an async function... by default we inherit isolation.
5799+ // If we have an async function or storage ... by default we inherit isolation.
57995800 if (ctx.LangOpts .hasFeature (Feature::NonisolatedNonsendingByDefault)) {
5800- if (auto *func = dyn_cast<AbstractFunctionDecl>(value);
5801- func && func->hasAsync () &&
5802- func->getModuleContext () == ctx.MainModule ) {
5801+ if (value->isAsync () && value->getModuleContext () == ctx.MainModule ) {
58035802 return {
58045803 {ActorIsolation::forCallerIsolationInheriting (), {}}, nullptr , {}};
58055804 }
@@ -6212,11 +6211,8 @@ static InferredActorIsolation computeActorIsolation(Evaluator &evaluator,
62126211 if (selfTypeIsolation.isolation ) {
62136212 auto isolation = selfTypeIsolation.isolation ;
62146213
6215- if (auto *func = dyn_cast<AbstractFunctionDecl>(value);
6216- ctx.LangOpts .hasFeature (
6217- Feature::NonisolatedNonsendingByDefault) &&
6218- func && func->hasAsync () &&
6219- func->getModuleContext () == ctx.MainModule &&
6214+ if (ctx.LangOpts .hasFeature (Feature::NonisolatedNonsendingByDefault) &&
6215+ value->isAsync () && value->getModuleContext () == ctx.MainModule &&
62206216 isolation.isNonisolated ()) {
62216217 isolation = ActorIsolation::forCallerIsolationInheriting ();
62226218 }
0 commit comments