Avatar
Avatar
Iceman
@swift-6.2-dev -swift-version 6 import Foundation class MyClass { let other: any Other init(other: any Other) { self.other = other DispatchQueue.global().async(execute: other.bar) } } @MainActor protocol Other { func bar() } (edited)
exit status 1 with stderr:<stdin>:7:53: error: converting non-Sendable function value to '@Sendable @convention(block) () -> Void' may introduce data races 5 | init(other: any Other) { 6 | self.other = other 7 | DispatchQueue.global().async(execute: other.bar) | `- error: converting non-Sendable function value to '@Sendable @convention(block) () -> Void' may introduce data races 8 | } 9 | } (edited)