@DependencyClient generates invalid @Sendable` function when closure parameter has a named argument
#396
Replies: 1 comment 2 replies
-
|
Hi @mehmetbaykar, there is no need to mark your closure as However, I still don't think that will work because key paths on main actor types are not sendable, and so you won't be able to use Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Description
There seems to be an issue in Dependencies Macros when using
@DependencyClientwith a closure that explicitly names its parameter.The macro-generated code differs depending on whether the closure includes a parameter name in its declaration. This inconsistency leads to invalid generated code and a compiler error.
Example
✅ This works as expected:
❌ This fails:
Generated Code
The macro expansion produces:
Error
Checklist
mainbranch of this package.Expected behavior
Both forms of closure declarations (with or without parameter names) should compile without errors. The macro should generate consistent and valid code for either case.
Environment
Actual behavior
No response
Steps to reproduce
No response
Dependencies version information
1.10.0
Destination operating system
iOS 26.0
Xcode version information
xCode 26.0
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions