@@ -1886,20 +1886,23 @@ ActorIsolation ActorIsolationRequest::evaluate(
1886
1886
}
1887
1887
}
1888
1888
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
+ }
1894
1897
}
1895
- }
1896
1898
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
+ }
1903
1906
}
1904
1907
}
1905
1908
0 commit comments