@@ -2283,10 +2283,6 @@ ActorIsolation ActorIsolationRequest::evaluate(
2283
2283
defaultIsolation = ActorIsolation::forActorInstance (classDecl);
2284
2284
}
2285
2285
2286
- // Disable inference of actor attributes outside of normal Swift source files.
2287
- if (!shouldInferAttributeInContext (value->getDeclContext ()))
2288
- return defaultIsolation;
2289
-
2290
2286
// Function used when returning an inferred isolation.
2291
2287
auto inferredIsolation = [&](ActorIsolation inferred) {
2292
2288
// Add an implicit attribute to capture the actor isolation that was
@@ -2340,29 +2336,31 @@ ActorIsolation ActorIsolationRequest::evaluate(
2340
2336
return getActorIsolation (accessor->getStorage ());
2341
2337
}
2342
2338
2343
- // If the declaration witnesses a protocol requirement that is isolated,
2344
- // use that.
2345
- if (auto witnessedIsolation = getIsolationFromWitnessedRequirements (value)) {
2346
- return inferredIsolation (*witnessedIsolation);
2347
- }
2339
+ if (shouldInferAttributeInContext (value->getDeclContext ())) {
2340
+ // If the declaration witnesses a protocol requirement that is isolated,
2341
+ // use that.
2342
+ if (auto witnessedIsolation = getIsolationFromWitnessedRequirements (value)) {
2343
+ return inferredIsolation (*witnessedIsolation);
2344
+ }
2345
+
2346
+ // If the declaration is a class with a superclass that has specified
2347
+ // isolation, use that.
2348
+ if (auto classDecl = dyn_cast<ClassDecl>(value)) {
2349
+ if (auto superclassDecl = classDecl->getSuperclassDecl ()) {
2350
+ auto superclassIsolation = getActorIsolation (superclassDecl);
2351
+ if (!superclassIsolation.isUnspecified ()) {
2352
+ if (superclassIsolation.requiresSubstitution ()) {
2353
+ Type superclassType = classDecl->getSuperclass ();
2354
+ if (!superclassType)
2355
+ return ActorIsolation::forUnspecified ();
2356
+
2357
+ SubstitutionMap subs = superclassType->getMemberSubstitutionMap (
2358
+ classDecl->getModuleContext (), classDecl);
2359
+ superclassIsolation = superclassIsolation.subst (subs);
2360
+ }
2348
2361
2349
- // If the declaration is a class with a superclass that has specified
2350
- // isolation, use that.
2351
- if (auto classDecl = dyn_cast<ClassDecl>(value)) {
2352
- if (auto superclassDecl = classDecl->getSuperclassDecl ()) {
2353
- auto superclassIsolation = getActorIsolation (superclassDecl);
2354
- if (!superclassIsolation.isUnspecified ()) {
2355
- if (superclassIsolation.requiresSubstitution ()) {
2356
- Type superclassType = classDecl->getSuperclass ();
2357
- if (!superclassType)
2358
- return ActorIsolation::forUnspecified ();
2359
-
2360
- SubstitutionMap subs = superclassType->getMemberSubstitutionMap (
2361
- classDecl->getModuleContext (), classDecl);
2362
- superclassIsolation = superclassIsolation.subst (subs);
2362
+ return inferredIsolation (superclassIsolation);
2363
2363
}
2364
-
2365
- return inferredIsolation (superclassIsolation);
2366
2364
}
2367
2365
}
2368
2366
}
0 commit comments