File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Tests/CasePathsMacrosTests Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ extension DeclModifierSyntax {
238
238
var isNeededAccessLevelModifier : Bool {
239
239
switch self . name. tokenKind {
240
240
case . keyword( . public) : return true
241
+ case . keyword( . package ) : return true
241
242
default : return false
242
243
}
243
244
}
Original file line number Diff line number Diff line change @@ -165,6 +165,37 @@ final class CasePathableMacroTests: XCTestCase {
165
165
}
166
166
"""
167
167
}
168
+ assertMacro {
169
+ """
170
+ @CasePathable package enum Foo {
171
+ case bar(Int)
172
+ }
173
+ """
174
+ } expansion: {
175
+ """
176
+ package enum Foo {
177
+ case bar(Int)
178
+
179
+ package struct AllCasePaths {
180
+ package var bar: CasePaths.AnyCasePath<Foo, Int> {
181
+ CasePaths.AnyCasePath<Foo, Int>(
182
+ embed: Foo.bar,
183
+ extract: {
184
+ guard case let .bar(v0) = $0 else {
185
+ return nil
186
+ }
187
+ return v0
188
+ }
189
+ )
190
+ }
191
+ }
192
+ package static var allCasePaths: AllCasePaths { AllCasePaths() }
193
+ }
194
+
195
+ extension Foo: CasePaths.CasePathable {
196
+ }
197
+ """
198
+ }
168
199
assertMacro {
169
200
"""
170
201
@CasePathable private enum Foo {
You can’t perform that action at this time.
0 commit comments