@@ -4951,10 +4951,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
49514951 // return caller isolation inheriting.
49524952 if (decl->getASTContext ().LangOpts .hasFeature (
49534953 Feature::NonisolatedNonsendingByDefault)) {
4954- if (auto *func = dyn_cast<AbstractFunctionDecl>(decl);
4955- func && func->hasAsync () &&
4956- func->getModuleContext () == decl->getASTContext ().MainModule ) {
4957- return ActorIsolation::forCallerIsolationInheriting ();
4954+ if (auto *value = dyn_cast<ValueDecl>(decl)) {
4955+ if (value->isAsync () &&
4956+ value->getModuleContext () == decl->getASTContext ().MainModule ) {
4957+ return ActorIsolation::forCallerIsolationInheriting ();
4958+ }
49584959 }
49594960 }
49604961
@@ -5815,11 +5816,9 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
58155816 return *result;
58165817 }
58175818
5818- // If we have an async function... by default we inherit isolation.
5819+ // If we have an async function or storage ... by default we inherit isolation.
58195820 if (ctx.LangOpts .hasFeature (Feature::NonisolatedNonsendingByDefault)) {
5820- if (auto *func = dyn_cast<AbstractFunctionDecl>(value);
5821- func && func->hasAsync () &&
5822- func->getModuleContext () == ctx.MainModule ) {
5821+ if (value->isAsync () && value->getModuleContext () == ctx.MainModule ) {
58235822 return {
58245823 {ActorIsolation::forCallerIsolationInheriting (), {}}, nullptr , {}};
58255824 }
@@ -6232,11 +6231,8 @@ static InferredActorIsolation computeActorIsolation(Evaluator &evaluator,
62326231 if (selfTypeIsolation.isolation ) {
62336232 auto isolation = selfTypeIsolation.isolation ;
62346233
6235- if (auto *func = dyn_cast<AbstractFunctionDecl>(value);
6236- ctx.LangOpts .hasFeature (
6237- Feature::NonisolatedNonsendingByDefault) &&
6238- func && func->hasAsync () &&
6239- func->getModuleContext () == ctx.MainModule &&
6234+ if (ctx.LangOpts .hasFeature (Feature::NonisolatedNonsendingByDefault) &&
6235+ value->isAsync () && value->getModuleContext () == ctx.MainModule &&
62406236 isolation.isNonisolated ()) {
62416237 isolation = ActorIsolation::forCallerIsolationInheriting ();
62426238 }
0 commit comments