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) {
6130
6130
// in {distributed} actor-isolated contexts nor in nonisolated
6131
6131
// contexts.
6132
6132
6133
- // Local declarations must check the isolation of their
6134
- // decl context.
6135
6133
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.
6136
6143
auto contextIsolation =
6137
6144
getActorIsolationOfContext (value->getDeclContext ());
6138
6145
if (!contextIsolation.isMainActor ())
Original file line number Diff line number Diff line change @@ -258,7 +258,13 @@ class CustomActorIsolated {
258
258
259
259
var global = 0
260
260
261
- func onMain( ) {
261
+ func onMain( ) async {
262
+ await withTaskGroup { group in
263
+ group. addTask { }
264
+
265
+ await group. next ( )
266
+ }
267
+
262
268
struct Nested {
263
269
// CHECK: // static useGlobal() in Nested #1 in onMain()
264
270
// CHECK-NEXT: // Isolation: global_actor. type: MainActor
You can’t perform that action at this time.
0 commit comments