Global actor isolation and protocols

I'm a bit confused about the interaction between actor-isolated protocols and the notion of Sendable. Can someone please clarify? Imagine, I have

@MainActor
protocol FooProtocol {
  func bar() async
  func doIt()
}

extension FooProtocol {
  func doIt() {
    Task {
      @MainActor in await self.bar()
      // warning: Cannot use parameter 'self' with a non-sendable
      // type 'Self' from concurrently-executed code
    }
  }
}

According to the proposal swift-evolution/0316-global-actors.md at main · apple/swift-evolution · GitHub this should be possible to do without a warning. Am I missing something here? Is this a limitation of the current compiler version (I'm using Xcode 13.2.1) and it will be changed in the future?

Terms of Service

Privacy Policy

Cookie Policy