Skip to content

Commit 66708a7

Browse files
authored
Note in documentation when #expect(throws:) started returning a value. (#980)
DocC doesn't let us annotate our return type's availability separately from our macros' availability, and we can't include both the old symbols and new ones because it is ambiguous at compile time, so this PR explains in prose when the return types were added. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent e12e243 commit 66708a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/Testing/Expectations/Expectation+Macro.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ public macro require<T>(
160160
/// is running in the current task. Any value returned by `expression` is
161161
/// discarded.
162162
///
163+
/// - Note: If you use this macro with a Swift compiler version lower than 6.1,
164+
/// it doesn't return a value.
165+
///
163166
/// If the thrown error need only equal another instance of [`Error`](https://developer.apple.com/documentation/swift/error),
164167
/// use ``expect(throws:_:sourceLocation:performing:)-7du1h`` instead.
165168
///
@@ -224,6 +227,9 @@ public macro require<T>(
224227
/// is running in the current task and an instance of ``ExpectationFailedError``
225228
/// is thrown. Any value returned by `expression` is discarded.
226229
///
230+
/// - Note: If you use this macro with a Swift compiler version lower than 6.1,
231+
/// it doesn't return a value.
232+
///
227233
/// If the thrown error need only equal another instance of [`Error`](https://developer.apple.com/documentation/swift/error),
228234
/// use ``require(throws:_:sourceLocation:performing:)-4djuw`` instead.
229235
///
@@ -286,6 +292,9 @@ public macro require<R>(
286292
/// not equal to `error`, an ``Issue`` is recorded for the test that is running
287293
/// in the current task. Any value returned by `expression` is discarded.
288294
///
295+
/// - Note: If you use this macro with a Swift compiler version lower than 6.1,
296+
/// it doesn't return a value.
297+
///
289298
/// If the thrown error need only be an instance of a particular type, use
290299
/// ``expect(throws:_:sourceLocation:performing:)-1hfms`` instead.
291300
@discardableResult
@@ -327,6 +336,9 @@ public macro require<R>(
327336
/// in the current task and an instance of ``ExpectationFailedError`` is thrown.
328337
/// Any value returned by `expression` is discarded.
329338
///
339+
/// - Note: If you use this macro with a Swift compiler version lower than 6.1,
340+
/// it doesn't return a value.
341+
///
330342
/// If the thrown error need only be an instance of a particular type, use
331343
/// ``require(throws:_:sourceLocation:performing:)-7n34r`` instead.
332344
@discardableResult

0 commit comments

Comments
 (0)