Skip to content

Commit 4823a26

Browse files
authored
Guard macro declarations behind hasFeature(Macros) (#1071)
To enable building this package with a "minimal" Swift toolchain whose compiler does not have support for macros, guard the macro declarations behind `#if hasFeature(Macros)`. This has no effect on anything but the toolchain bootstrap process.
1 parent 86d660b commit 4823a26

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Sources/FoundationEssentials/Predicate/Expression.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public struct Expression<each Input, Output> : Sendable {
2727
}
2828
}
2929

30+
#if hasFeature(Macros)
3031
@freestanding(expression)
3132
@available(FoundationPredicate 0.4, *)
3233
public macro Expression<each Input, Output>(_ body: (repeat each Input) -> Output) -> Expression<repeat each Input, Output> = #externalMacro(module: "FoundationMacros", type: "ExpressionMacro")
34+
#endif

Sources/FoundationEssentials/Predicate/Predicate.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ public struct Predicate<each Input> : Sendable {
2727
}
2828
}
2929

30+
#if hasFeature(Macros)
3031
@freestanding(expression)
3132
@available(FoundationPredicate 0.1, *)
3233
public macro Predicate<each Input>(_ body: (repeat each Input) -> Bool) -> Predicate<repeat each Input> = #externalMacro(module: "FoundationMacros", type: "PredicateMacro")
34+
#endif
3335

3436
@available(FoundationPredicate 0.1, *)
3537
extension Predicate {

0 commit comments

Comments
 (0)