Skip to content

Commit dac0e71

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents ba501a3 + c72a454 commit dac0e71

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,11 @@ namespace {
11411141
return true;
11421142
}
11431143

1144-
case ActorIsolation::Independent:
11451144
case ActorIsolation::IndependentUnsafe:
1145+
// Allow unrestricted use of something in a global actor.
1146+
return false;
1147+
1148+
case ActorIsolation::Independent:
11461149
if (inspectForImplicitlyAsync())
11471150
return false;
11481151

@@ -1168,8 +1171,8 @@ namespace {
11681171
}
11691172
noteIsolatedActorMember(value);
11701173
};
1171-
1172-
if (AbstractFunctionDecl const* fn =
1174+
1175+
if (AbstractFunctionDecl const* fn =
11731176
dyn_cast_or_null<AbstractFunctionDecl>(declContext->getAsDecl())) {
11741177
bool isAsyncContext = fn->isAsyncContext();
11751178

test/attr/actorindependent_unsafe.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,21 @@ actor class Actor4 {
211211
set { time = newValue }
212212
}
213213
}
214+
215+
actor class SomeActor { }
216+
217+
@globalActor
218+
struct SomeGlobalActor {
219+
static let shared = SomeActor()
220+
}
221+
222+
@SomeGlobalActor
223+
class NormalClass {
224+
var bar: String = ""
225+
226+
@actorIndependent(unsafe)
227+
var unsafeBar: String { bar }
228+
229+
@actorIndependent(unsafe)
230+
func getUnsafeBar() -> String { bar }
231+
}

0 commit comments

Comments
 (0)