@@ -1886,20 +1886,23 @@ ActorIsolation ActorIsolationRequest::evaluate(
18861886 }
18871887 }
18881888
1889- // If the declaration is in an extension that has one of the isolation
1890- // attributes, use that.
1891- if (auto ext = dyn_cast<ExtensionDecl>(value->getDeclContext ())) {
1892- if (auto isolationFromAttr = getIsolationFromAttributes (ext)) {
1893- return inferredIsolation (*isolationFromAttr);
1889+ // Instance members can infer isolation from their context.
1890+ if (value->isInstanceMember ()) {
1891+ // If the declaration is in an extension that has one of the isolation
1892+ // attributes, use that.
1893+ if (auto ext = dyn_cast<ExtensionDecl>(value->getDeclContext ())) {
1894+ if (auto isolationFromAttr = getIsolationFromAttributes (ext)) {
1895+ return inferredIsolation (*isolationFromAttr);
1896+ }
18941897 }
1895- }
18961898
1897- // If the declaration is in a nominal type (or extension thereof) that
1898- // has isolation, use that.
1899- if (auto selfTypeDecl = value->getDeclContext ()->getSelfNominalTypeDecl ()) {
1900- auto selfTypeIsolation = getActorIsolation (selfTypeDecl);
1901- if (!selfTypeIsolation.isUnspecified ()) {
1902- return inferredIsolation (selfTypeIsolation);
1899+ // If the declaration is in a nominal type (or extension thereof) that
1900+ // has isolation, use that.
1901+ if (auto selfTypeDecl = value->getDeclContext ()->getSelfNominalTypeDecl ()) {
1902+ auto selfTypeIsolation = getActorIsolation (selfTypeDecl);
1903+ if (!selfTypeIsolation.isUnspecified ()) {
1904+ return inferredIsolation (selfTypeIsolation);
1905+ }
19031906 }
19041907 }
19051908
0 commit comments