Skip to content

Commit a1c49d0

Browse files
treastrainphausler
andauthored
@Observable Macro supports properties with the package access modifier (#71061)
* `@Observable` Macro supports properties with the `package` access modifier #71060 * Cherry-pick "Move the tests for package scopes to the module interface tests" 4e274ce --------- Co-authored-by: Philippe Hausler <[email protected]>
1 parent 4b440a1 commit a1c49d0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/Macros/Sources/ObservationMacros/ObservableMacro.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ extension DeclModifierListSyntax {
118118
case .fileprivate: fallthrough
119119
case .private: fallthrough
120120
case .internal: fallthrough
121+
case .package: fallthrough
121122
case .public:
122123
return false
123124
default:

test/ModuleInterface/Observable.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -plugin-path %swift-plugin-dir -disable-availability-checking
3-
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -module-name Library -disable-availability-checking
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -package-name Library -module-name Library -plugin-path %swift-plugin-dir -disable-availability-checking
3+
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -package-name Library -module-name Library -disable-availability-checking
44
// RUN: %FileCheck %s < %t/Library.swiftinterface
55

66
// REQUIRES: swift_swift_parser
@@ -15,6 +15,7 @@ import Observation
1515
@Observable
1616
public class SomeClass {
1717
public var field = 3
18+
package var test = 4
1819
@ObservationIgnored public var ignored = 4
1920
}
2021

0 commit comments

Comments
 (0)