@@ -4955,10 +4955,11 @@ getIsolationFromAttributes(const Decl *decl, bool shouldDiagnose = true,
4955
4955
// return caller isolation inheriting.
4956
4956
if (decl->getASTContext ().LangOpts .hasFeature (
4957
4957
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
+ }
4962
4963
}
4963
4964
}
4964
4965
@@ -5819,11 +5820,9 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
5819
5820
return *result;
5820
5821
}
5821
5822
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.
5823
5824
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 ) {
5827
5826
return {
5828
5827
{ActorIsolation::forCallerIsolationInheriting (), {}}, nullptr , {}};
5829
5828
}
@@ -6236,11 +6235,8 @@ static InferredActorIsolation computeActorIsolation(Evaluator &evaluator,
6236
6235
if (selfTypeIsolation.isolation ) {
6237
6236
auto isolation = selfTypeIsolation.isolation ;
6238
6237
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 &&
6244
6240
isolation.isNonisolated ()) {
6245
6241
isolation = ActorIsolation::forCallerIsolationInheriting ();
6246
6242
}
0 commit comments