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) {
6088
6088
// in {distributed} actor-isolated contexts nor in nonisolated
6089
6089
// contexts.
6090
6090
6091
- // Local declarations must check the isolation of their
6092
- // decl context.
6093
6091
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.
6094
6101
auto contextIsolation =
6095
6102
getActorIsolationOfContext (value->getDeclContext ());
6096
6103
if (!contextIsolation.isMainActor ())
Original file line number Diff line number Diff line change @@ -276,7 +276,13 @@ class CustomActorIsolated {
276
276
277
277
var global = 0
278
278
279
- func onMain( ) {
279
+ func onMain( ) async {
280
+ await withTaskGroup { group in
281
+ group. addTask { }
282
+
283
+ await group. next ( )
284
+ }
285
+
280
286
struct Nested {
281
287
// CHECK: // static useGlobal() in Nested #1 in onMain()
282
288
// CHECK-NEXT: // Isolation: global_actor. type: MainActor
You can’t perform that action at this time.
0 commit comments