Skip to content

Commit 1afaf74

Browse files
etcwildeDougGregor
andcommitted
top-level is @MainActor(unsafe) below swift 6
Co-authored-by: Doug Gregor <[email protected]>
1 parent 72e03b7 commit 1afaf74

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9090,7 +9090,9 @@ ActorIsolation swift::getActorIsolationOfContext(DeclContext *dc) {
90909090
if (auto *tld = dyn_cast<TopLevelCodeDecl>(dc)) {
90919091
if (dc->isAsyncContext() || dc->getASTContext().LangOpts.WarnConcurrency) {
90929092
if (Type mainActor = dc->getASTContext().getMainActorType())
9093-
return ActorIsolation::forGlobalActor(mainActor, /*unsafe=*/false);
9093+
return ActorIsolation::forGlobalActor(
9094+
mainActor,
9095+
/*unsafe=*/!dc->getASTContext().isSwiftVersionAtLeast(6));
90949096
}
90959097
}
90969098

0 commit comments

Comments
 (0)