Skip to content

Commit 73b69bd

Browse files
authored
Modify isNeededAccessLevelModifier result conditions (#128)
1 parent 65b7259 commit 73b69bd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Sources/CasePathsMacros/CasePathableMacro.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ extension DeclModifierSyntax {
238238
var isNeededAccessLevelModifier: Bool {
239239
switch self.name.tokenKind {
240240
case .keyword(.public): return true
241+
case .keyword(.package): return true
241242
default: return false
242243
}
243244
}

Tests/CasePathsMacrosTests/CasePathableMacroTests.swift

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,37 @@ final class CasePathableMacroTests: XCTestCase {
165165
}
166166
"""
167167
}
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+
}
168199
assertMacro {
169200
"""
170201
@CasePathable private enum Foo {

0 commit comments

Comments
 (0)