Just to elaborate a bit on @AlexanderM's answer here, the possible sendability of a closure expression can depend on state that is not reflected in the parameter-and-return-type signature of the function type. An arbitrary function value of type (Result<some Sendable, some Sendable & Error>) -> Voidmay be sendable, but without visibility into the definition of the function itself, we can't know for sure. So your use of promise can't just assume that "sendable parameters and sendable return value means sendable," the author of the API providing the promise parameter needs to explicitly mark the function type @Sendable in order for us to rely on it. The fact that it hasn't been marked as @Sendable may be an oversight, or there may be some fundamental implementation reason that promise cannot be sent across isolation domains.
Hello @longvudai. The code mentioned does not suppress the warning anymore. Actually, the warning has changed to Task-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race; this is an error in the Swift 6 language mode. Is there any another option to fix it?