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 @@ -6130,9 +6130,16 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
61306130 // in {distributed} actor-isolated contexts nor in nonisolated
61316131 // contexts.
61326132
6133- // Local declarations must check the isolation of their
6134- // decl context.
61356133 if (value->getDeclContext ()->isLocalContext ()) {
6134+ // Local storage is always nonisolated; region isolation computes
6135+ // whether the value is in an actor-isolated region based on
6136+ // the initializer expression.
6137+ auto *var = dyn_cast<VarDecl>(value);
6138+ if (var && var->hasStorage ())
6139+ return {};
6140+
6141+ // Other local declarations must check the isolation of their
6142+ // decl context.
61366143 auto contextIsolation =
61376144 getActorIsolationOfContext (value->getDeclContext ());
61386145 if (!contextIsolation.isMainActor ())
Original file line number Diff line number Diff line change @@ -258,7 +258,13 @@ class CustomActorIsolated {
258258
259259var global = 0
260260
261- func onMain( ) {
261+ func onMain( ) async {
262+ await withTaskGroup { group in
263+ group. addTask { }
264+
265+ await group. next ( )
266+ }
267+
262268 struct Nested {
263269 // CHECK: // static useGlobal() in Nested #1 in onMain()
264270 // CHECK-NEXT: // Isolation: global_actor. type: MainActor
You can’t perform that action at this time.
0 commit comments