Skip to content

Commit 37ce7d9

Browse files
committed
Work around compiler crash (rdar://143586718)
1 parent 7cd16fb commit 37ce7d9

File tree

1 file changed

+4
-49
lines changed

1 file changed

+4
-49
lines changed

Sources/Testing/Expectations/ExpectationContext+Pointers.swift

+4-49
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,6 @@ extension __ExpectationContext {
3232
captureValue(value, id)
3333
}
3434

35-
/// Capture a pointer for use if the expectation currently being evaluated
36-
/// fails.
37-
///
38-
/// - Parameters:
39-
/// - value: The value to pass through.
40-
/// - id: A value that uniquely identifies the represented expression in the
41-
/// context of the expectation currently being evaluated.
42-
///
43-
/// - Returns: `value`, verbatim.
44-
///
45-
/// This overload of `callAsFunction()` is used when a pointer is passed to
46-
/// allow for the correct handling of implicit pointer conversion after it
47-
/// returns.
48-
///
49-
/// - Warning: This function is used to implement the `#expect()` and
50-
/// `#require()` macros. Do not call it directly.
51-
@_disfavoredOverload
52-
@inlinable public mutating func callAsFunction<P>(_ value: P?, _ id: __ExpressionID) -> P? where P: _Pointer {
53-
captureValue(value, id)
54-
}
55-
5635
/// Capture a string for use if the expectation currently being evaluated
5736
/// fails.
5837
///
@@ -74,28 +53,6 @@ extension __ExpectationContext {
7453
captureValue(value, id)
7554
}
7655

77-
/// Capture an optional string for use if the expectation currently being
78-
/// evaluated fails.
79-
///
80-
/// - Parameters:
81-
/// - value: The value to pass through.
82-
/// - id: A value that uniquely identifies the represented expression in the
83-
/// context of the expectation currently being evaluated.
84-
///
85-
/// - Returns: `value`, verbatim.
86-
///
87-
/// This overload of `callAsFunction()` is used when an optional string is
88-
/// passed to allow for the correct handling of implicit C string conversion
89-
/// after it returns. For more information about implicit type conversions
90-
/// performed by the Swift compiler, see [here](https://developer.apple.com/documentation/swift/calling-functions-with-pointer-parameters#Pass-a-Constant-Pointer-as-a-Parameter).
91-
///
92-
/// - Warning: This function is used to implement the `#expect()` and
93-
/// `#require()` macros. Do not call it directly.
94-
@_disfavoredOverload
95-
@inlinable public mutating func callAsFunction(_ value: String?, _ id: __ExpressionID) -> String? {
96-
captureValue(value, id)
97-
}
98-
9956
/// Capture an array for use if the expectation currently being evaluated
10057
/// fails.
10158
///
@@ -117,7 +74,7 @@ extension __ExpectationContext {
11774
captureValue(value, id)
11875
}
11976

120-
/// Capture an optional array for use if the expectation currently being
77+
/// Capture an optional value for use if the expectation currently being
12178
/// evaluated fails.
12279
///
12380
/// - Parameters:
@@ -127,15 +84,13 @@ extension __ExpectationContext {
12784
///
12885
/// - Returns: `value`, verbatim.
12986
///
130-
/// This overload of `callAsFunction()` is used when an optional array is
131-
/// passed to allow for the correct handling of implicit C array conversion
132-
/// after it returns. For more information about implicit type conversions
133-
/// performed by the Swift compiler, see [here](https://developer.apple.com/documentation/swift/calling-functions-with-pointer-parameters#Pass-a-Constant-Pointer-as-a-Parameter).
87+
/// This overload of `callAsFunction()` is used when an optional value is
88+
/// passed to allow for the correct handling of various implicit conversions.
13489
///
13590
/// - Warning: This function is used to implement the `#expect()` and
13691
/// `#require()` macros. Do not call it directly.
13792
@_disfavoredOverload
138-
@inlinable public mutating func callAsFunction<E>(_ value: Array<E>?, _ id: __ExpressionID) -> Array<E>? {
93+
@inlinable public mutating func callAsFunction<T>(_ value: T?, _ id: __ExpressionID) -> T? {
13994
captureValue(value, id)
14095
}
14196
}

0 commit comments

Comments
 (0)