@@ -73,6 +73,47 @@ public func unimplemented<each Argument, Result>(
73
73
}
74
74
}
75
75
76
+ #if compiler(>=6)
77
+ /// Returns a throwing closure that reports an issue and throws a given error when invoked.
78
+ ///
79
+ /// Useful for creating closures that need to be overridden by users of your API, and if it is
80
+ /// ever invoked without being overridden an issue will be reported. See
81
+ /// <doc:GettingStarted#Unimplemented-closures> for more information.
82
+ ///
83
+ /// - Parameters:
84
+ /// - description: An optional description of the unimplemented closure.
85
+ /// - failure: The error thrown by the unimplemented closure.
86
+ /// - fileID: The fileID.
87
+ /// - filePath: The filePath.
88
+ /// - function: The function.
89
+ /// - line: The line.
90
+ /// - column: The column.
91
+ /// - Returns: A throwing closure that reports an issue and throws an error when invoked.
92
+ public func unimplemented< each Argument , Failure: Error , Result> (
93
+ _ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
94
+ throwing failure: @autoclosure @escaping @Sendable ( ) -> Failure ,
95
+ fileID: StaticString = #fileID,
96
+ filePath: StaticString = #filePath,
97
+ function: StaticString = #function,
98
+ line: UInt = #line,
99
+ column: UInt = #column
100
+ ) -> @Sendable ( repeat each Argument) throws( Failure ) -> Result {
101
+ return { ( argument: repeat each Argument ) throws ( Failure) in
102
+ let description = description ( )
103
+ _fail (
104
+ description,
105
+ ( repeat each argument) ,
106
+ fileID: fileID,
107
+ filePath: filePath,
108
+ function: function,
109
+ line: line,
110
+ column: column
111
+ )
112
+ throw failure ( )
113
+ }
114
+ }
115
+ #endif
116
+
76
117
/// Returns an asynchronous closure that reports an issue when invoked.
77
118
///
78
119
/// Useful for creating closures that need to be overridden by users of your API, and if it is
@@ -149,6 +190,49 @@ public func unimplemented<each Argument, Result>(
149
190
}
150
191
}
151
192
193
+ #if compiler(>=6)
194
+ /// Returns a throwing, asynchronous closure that reports an issue and throws a given error when
195
+ /// invoked.
196
+ ///
197
+ /// Useful for creating closures that need to be overridden by users of your API, and if it is
198
+ /// ever invoked without being overridden an issue will be reported. See
199
+ /// <doc:GettingStarted#Unimplemented-closures> for more information.
200
+ ///
201
+ /// - Parameters:
202
+ /// - description: An optional description of the unimplemented closure.
203
+ /// - failure: The error thrown by the unimplemented closure.
204
+ /// - fileID: The fileID.
205
+ /// - filePath: The filePath.
206
+ /// - function: The function.
207
+ /// - line: The line.
208
+ /// - column: The column.
209
+ /// - Returns: A throwing, asynchronous closure that reports an issue and throws an error when
210
+ /// invoked.
211
+ public func unimplemented< each Argument , Failure: Error , Result> (
212
+ _ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
213
+ throwing failure: @autoclosure @escaping @Sendable ( ) -> Failure ,
214
+ fileID: StaticString = #fileID,
215
+ filePath: StaticString = #filePath,
216
+ function: StaticString = #function,
217
+ line: UInt = #line,
218
+ column: UInt = #column
219
+ ) -> @Sendable ( repeat each Argument) async throws ( Failure ) -> Result {
220
+ return { ( argument: repeat each Argument ) async throws ( Failure) in
221
+ let description = description ( )
222
+ _fail (
223
+ description,
224
+ ( repeat each argument) ,
225
+ fileID: fileID,
226
+ filePath: filePath,
227
+ function: function,
228
+ line: line,
229
+ column: column
230
+ )
231
+ throw failure ( )
232
+ }
233
+ }
234
+ #endif
235
+
152
236
@_disfavoredOverload
153
237
public func unimplemented< Result> (
154
238
_ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
0 commit comments