swift
2c3bef82 - Top-level variables are on the MainActor

Commit
3 years ago
Top-level variables are on the MainActor This is an interesting patch that may raise some eyebrows. The machinery we have now can completely handle arbitrary global-actor isolation on the global variables. I'm forcing the variables to be on the main actor because in an ideal future, the variables won't be global and will actually be local to the implicit `async_Main` function, where they will be isolated to the main actor by virtue of the `async_Main` function being run by the main actor executor. For that to work, we can't really allow top-level variables to have global actor isolation since local variables can't have global actor isolation. So while there is no technical reason we can't handle it now, to avoid source-breaking changes in the future, I'm removing the ability to explicitly declare a global actor on top-level global variables and forcing them all to be on the MainActor implicitly.
Author
Committer
Parents
  • include/swift/AST
    • File
      DiagnosticsSema.def
  • lib/Sema
    • File
      TypeCheckConcurrency.cpp