Closed NachoSoto closed 2 months ago
Just realized this also happens with the @Observable
macro.
Thank you for the report!
And yeah, this is a rather unfortunate bug in Swift: https://github.com/apple/swift/issues/66450. I run into this one a lot. Some circularity issues were addressed in Xcode 15.1, but the cases that I run into are still outstanding, and usually have the same shape as your example.
You can sometimes work around the bug by moving the extension to another file, which can make sense depending on the nature/necessity of the macro. For MemberwiseInit, I personally tend to fall back to a boilerplate init
and a FIXME.
This appears fixed in Swift 6! I confirmed using Xcode 16.0 beta 2 (16A5171r).
Closing, Swift 6 has been released with this fix. 🥳
Description
Consider this code:
Checklist
main
branch of this package.Expected behavior
MemberwiseInit
should create a correctinit
Actual behavior
swift-memberwise-init-macro version information
main
Destination operating system
iOS 17.2
Xcode version information
Xcode 15.1
Swift Compiler version information