Closed vlm closed 10 months ago
Thanks for this, @vlm! Do we not need to declare the Parsed
enum as sendable as well? That can indirectly store a user-supplied closure via initializers that include a transform
parameter, which could break encapsulation. Should we look at adding @Sendable
annotations to those closures at the same time?
@natecook1000 looking...
@natecook1000 these conformances doesn't appear to be required. Added a test to showcase that. No warnings.
@swift-ci Please test
Is it possible to put the additional sendable restrictions behind conditional compilation so this change isn't source breaking?
@rauhul None of these changes should be source breaking, since checking is only a warning until you upgrade to Swift 6 mode. Additionally, to turn off the warnings making other source changes, a package that depends on ArgumentParser can add @preconcurrency
to their import statement.
@swift-ci Please test
It can be useful to send
AsyncParsableCommand
as an argument to some function. This is trivial to do in a non-async context. However, inasync
context the type that is sent as an argument has to be Sendable. This patch addsSendable
conformance so this becomes expressible and warning-free:The warnings will become errors in Swift 6, so this is a forward-looking change.
Checklist