Skip to content

Commit f60d855

Browse files
authored
[Observation] Member properties that have visibility attributes should rename using trailing trivia (#65812) (#66002)
1 parent c050bcd commit f60d855

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Macros/Sources/ObservationMacros/ObservableMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ extension DiagnosticsError {
9595

9696
extension ModifierListSyntax {
9797
func privatePrefixed(_ prefix: String) -> ModifierListSyntax {
98-
let modifier: DeclModifierSyntax = DeclModifierSyntax(name: "private")
98+
let modifier: DeclModifierSyntax = DeclModifierSyntax(name: "private", trailingTrivia: .space)
9999
return ModifierListSyntax([modifier] + filter {
100100
switch $0.name.tokenKind {
101101
case .keyword(let keyword):

test/stdlib/Observation/Observable.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class ContainsWeak {
2626
weak var obj: AnyObject? = nil
2727
}
2828

29+
@Observable
30+
public class PublicContainsWeak {
31+
public weak var obj: AnyObject? = nil
32+
}
33+
2934
@Observable
3035
class ContainsUnowned {
3136
unowned var obj: AnyObject? = nil

0 commit comments

Comments
 (0)