Skip to content

Commit 819a7a0

Browse files
authored
Work around issue parsing macro declarations with other attributes. (#379)
1 parent 605a181 commit 819a7a0

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Sources/Testing/Expectations/Expectation+Macro.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@
9393
/// `optionalValue` may be ambiguous (i.e. it is unclear if the developer
9494
/// intended to check for a boolean value or unwrap an optional boolean value)
9595
/// and provides additional compile-time diagnostics when it is.
96+
@freestanding(expression)
9697
@_documentation(visibility: private)
97-
@freestanding(expression) public macro require(
98+
public macro require(
9899
_ optionalValue: Bool?,
99100
_ comment: @autoclosure () -> Comment? = nil,
100101
sourceLocation: SourceLocation = SourceLocation()

Sources/Testing/Test+Macro.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ public typealias __XCTestCompatibleSelector = Never
6767
/// ## See Also
6868
///
6969
/// - <doc:OrganizingTests>
70+
@attached(member) @attached(peer)
7071
@_documentation(visibility: private)
71-
@attached(member) @attached(peer) public macro Suite(
72+
public macro Suite(
7273
_ traits: any SuiteTrait...
7374
) = #externalMacro(module: "TestingMacros", type: "SuiteDeclarationMacro")
7475

@@ -123,8 +124,9 @@ extension Test {
123124
/// ## See Also
124125
///
125126
/// - ``Test(_:_:)``
127+
@attached(peer)
126128
@_documentation(visibility: private)
127-
@attached(peer) public macro Test(
129+
public macro Test(
128130
_ traits: any TestTrait...
129131
) = #externalMacro(module: "TestingMacros", type: "TestDeclarationMacro")
130132

@@ -192,8 +194,9 @@ extension [Test.__Parameter] {
192194
/// ## See Also
193195
///
194196
/// - ``Test(_:arguments:)-35dat``
197+
@attached(peer)
195198
@_documentation(visibility: private)
196-
@attached(peer) public macro Test<C>(
199+
public macro Test<C>(
197200
_ traits: any TestTrait...,
198201
arguments collection: C
199202
) = #externalMacro(module: "TestingMacros", type: "TestDeclarationMacro") where C: Collection & Sendable, C.Element: Sendable
@@ -268,8 +271,9 @@ extension Test {
268271
/// ## See Also
269272
///
270273
/// - <doc:DefiningTests>
274+
@attached(peer)
271275
@_documentation(visibility: private)
272-
@attached(peer) public macro Test<C1, C2>(
276+
public macro Test<C1, C2>(
273277
_ traits: any TestTrait...,
274278
arguments collection1: C1, _ collection2: C2
275279
) = #externalMacro(module: "TestingMacros", type: "TestDeclarationMacro") where C1: Collection & Sendable, C1.Element: Sendable, C2: Collection & Sendable, C2.Element: Sendable
@@ -321,8 +325,9 @@ extension Test {
321325
/// ## See Also
322326
///
323327
/// - <doc:DefiningTests>
328+
@attached(peer)
324329
@_documentation(visibility: private)
325-
@attached(peer) public macro Test<C1, C2>(
330+
public macro Test<C1, C2>(
326331
_ traits: any TestTrait...,
327332
arguments zippedCollections: Zip2Sequence<C1, C2>
328333
) = #externalMacro(module: "TestingMacros", type: "TestDeclarationMacro") where C1: Collection & Sendable, C1.Element: Sendable, C2: Collection & Sendable, C2.Element: Sendable

0 commit comments

Comments
 (0)