Freestanding Declaration Macro Expanding Defer Block Causes Compiler Error starting with Swift 5.10 #72307
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
swift macro
Feature → declarations: Swift `macro` declarations
Description
With Swift 5.9, I implemented a Swift package which provides a freestanding declaration macro. That macro expands to two variable declarations and a
defer
block to start a signpost and define its end in thedefer
block immediately. It always compiled and worked fine. After updating to Swift 5.10, the expansion causes a compiler error.Reproduction
I have set up an example Swift macro package which implements the minimal example.
✅ It builds and works fine in Swift 5.9 (Xcode 15.2).
💥 It results in a compiler error in Swift 5.10 (Xcode 15.3) at the
defer
block of the macro expansion.Expected behavior
The macro expansion is accepted and does not cause a compiler error as before.
Environment
Additional information
I asked about this issue already in the Swift forums.
The text was updated successfully, but these errors were encountered: