@@ -4955,10 +4955,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
49554955 // return caller isolation inheriting.
49564956 if (decl->getASTContext ().LangOpts .hasFeature (
49574957 Feature::NonisolatedNonsendingByDefault)) {
4958- if (auto *func = dyn_cast<AbstractFunctionDecl>(decl);
4959- func && func->hasAsync () &&
4960- func->getModuleContext () == decl->getASTContext ().MainModule ) {
4961- return ActorIsolation::forCallerIsolationInheriting ();
4958+ if (auto *value = dyn_cast<ValueDecl>(decl)) {
4959+ if (value->isAsync () &&
4960+ value->getModuleContext () == decl->getASTContext ().MainModule ) {
4961+ return ActorIsolation::forCallerIsolationInheriting ();
4962+ }
49624963 }
49634964 }
49644965
@@ -5819,11 +5820,9 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
58195820 return *result;
58205821 }
58215822
5822- // If we have an async function... by default we inherit isolation.
5823+ // If we have an async function or storage ... by default we inherit isolation.
58235824 if (ctx.LangOpts .hasFeature (Feature::NonisolatedNonsendingByDefault)) {
5824- if (auto *func = dyn_cast<AbstractFunctionDecl>(value);
5825- func && func->hasAsync () &&
5826- func->getModuleContext () == ctx.MainModule ) {
5825+ if (value->isAsync () && value->getModuleContext () == ctx.MainModule ) {
58275826 return {
58285827 {ActorIsolation::forCallerIsolationInheriting (), {}}, nullptr , {}};
58295828 }
@@ -6236,11 +6235,8 @@ static InferredActorIsolation computeActorIsolation(Evaluator &evaluator,
62366235 if (selfTypeIsolation.isolation ) {
62376236 auto isolation = selfTypeIsolation.isolation ;
62386237
6239- if (auto *func = dyn_cast<AbstractFunctionDecl>(value);
6240- ctx.LangOpts .hasFeature (
6241- Feature::NonisolatedNonsendingByDefault) &&
6242- func && func->hasAsync () &&
6243- func->getModuleContext () == ctx.MainModule &&
6238+ if (ctx.LangOpts .hasFeature (Feature::NonisolatedNonsendingByDefault) &&
6239+ value->isAsync () && value->getModuleContext () == ctx.MainModule &&
62446240 isolation.isNonisolated ()) {
62456241 isolation = ActorIsolation::forCallerIsolationInheriting ();
62466242 }
0 commit comments