From 2bddee0c819ddf7bc1a8adbafbd94af7e0de2348 Mon Sep 17 00:00:00 2001 From: ra1028 Date: Fri, 4 Oct 2024 23:00:34 +0900 Subject: [PATCH] Add a comment about inheritance of actor isolation --- Sources/Atoms/AsyncPhase.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/Atoms/AsyncPhase.swift b/Sources/Atoms/AsyncPhase.swift index 0c981c6a..0452a651 100644 --- a/Sources/Atoms/AsyncPhase.swift +++ b/Sources/Atoms/AsyncPhase.swift @@ -29,7 +29,13 @@ public enum AsyncPhase { /// returned value as a success, or thrown error as a failure. /// /// - Parameter body: A async throwing closure to evaluate. - public init(catching body: @Sendable () async throws(Failure) -> Success) async { + public init( + // Adopt SE-0420 Inheritance of actor isolation instead of adding @Sendable + // to the body closure once the compiler crash that happens with Swift 6.0 + // when used in an initializer is solved. + // isolation: isolated (any Actor)? = #isolation, + catching body: @Sendable () async throws(Failure) -> Success + ) async { do { let value = try await body() self = .success(value)