File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -6088,9 +6088,16 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
60886088 // in {distributed} actor-isolated contexts nor in nonisolated
60896089 // contexts.
60906090
6091- // Local declarations must check the isolation of their
6092- // decl context.
60936091 if (value->getDeclContext ()->isLocalContext ()) {
6092+ // Local storage is always nonisolated; region isolation computes
6093+ // whether the value is in an actor-isolated region based on
6094+ // the initializer expression.
6095+ auto *var = dyn_cast<VarDecl>(value);
6096+ if (var && var->hasStorage ())
6097+ return {};
6098+
6099+ // Other local declarations must check the isolation of their
6100+ // decl context.
60946101 auto contextIsolation =
60956102 getActorIsolationOfContext (value->getDeclContext ());
60966103 if (!contextIsolation.isMainActor ())
Original file line number Diff line number Diff line change @@ -276,7 +276,13 @@ class CustomActorIsolated {
276276
277277var global = 0
278278
279- func onMain( ) {
279+ func onMain( ) async {
280+ await withTaskGroup { group in
281+ group. addTask { }
282+
283+ await group. next ( )
284+ }
285+
280286 struct Nested {
281287 // CHECK: // static useGlobal() in Nested #1 in onMain()
282288 // CHECK-NEXT: // Isolation: global_actor. type: MainActor
You can’t perform that action at this time.
0 commit comments