You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix a formatting issue if a member attribute macro is applied to properties that already have an attribute
If a variable already had a macro already had an attribute and we add a new attribute to it via a member macro, the produced code was invalid. For example,
```swift
@wrapStoredProperties
struct Foo {
@available(*, deprecated) var x: Int
}
```
produced
```swift
struct Foo {
@available(*, deprecated)
@Wrappervar x: Int
}
```
which is invalid because there is no space between `Wrapper` and `var`.
To fix this, transfer the trailing trivia from the last attribute to the last newly inserted attribute.
This way, we essentially insert the new attributes right after the last attribute in source, but before its trailing trivia, keeping the trivia that separates the attribute block from the variable itself.
```swift
struct Foo {
@available(*, deprecated)
@wrapper var x: Int
}
```
rdar://114275860
0 commit comments