@@ -19,14 +19,15 @@ import Swift
19
19
% 'THROWING',
20
20
% 'NON_THROWING',
21
21
% ]
22
- % OPERATION_PARAM = '@_inheritActorContext @_implicitSelfCapture _ operation: __owned @Sendable @escaping () async throws -> Success'
23
22
% for METHOD_VARIANT in METHOD_VARIANTS:
24
23
25
24
% IS_THROWING = METHOD_VARIANT == 'THROWING'
26
25
% if IS_THROWING:
27
26
% FAILURE_TYPE = 'Error'
27
+ % THROWS = 'throws '
28
28
% else:
29
29
% FAILURE_TYPE = 'Never'
30
+ % THROWS = ''
30
31
% end
31
32
32
33
@available(SwiftStdlib 6.2, *)
@@ -46,7 +47,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
46
47
public static func startSynchronously(
47
48
name: String? = nil,
48
49
priority: TaskPriority? = nil,
49
- @_implicitSelfCapture @_inheritActorContext(always) _ operation: sending @isolated(any) @escaping () async throws -> Success
50
+ @_implicitSelfCapture @_inheritActorContext(always) _ operation: sending @isolated(any) @escaping () async ${THROWS} -> Success
50
51
) -> Task<Success, ${FAILURE_TYPE}> {
51
52
immediate(name: name, priority: priority, operation: operation)
52
53
}
@@ -79,7 +80,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
79
80
public static func immediate(
80
81
name: String? = nil,
81
82
priority: TaskPriority? = nil,
82
- @_implicitSelfCapture @_inheritActorContext(always) operation: sending @isolated(any) @escaping () async throws -> Success
83
+ @_implicitSelfCapture @_inheritActorContext(always) operation: sending @isolated(any) @escaping () async ${THROWS} -> Success
83
84
) -> Task<Success, ${FAILURE_TYPE}> {
84
85
85
86
let builtinSerialExecutor =
@@ -235,15 +236,15 @@ extension ${GROUP_TYPE} {
235
236
% 'THROWING',
236
237
% 'NON_THROWING',
237
238
% ]
238
- % OPERATION_PARAM = '@_inheritActorContext @_implicitSelfCapture _ operation: __owned @Sendable @escaping @MainActor () async throws -> Success'
239
239
% for METHOD_VARIANT in METHOD_VARIANTS:
240
240
241
241
% IS_THROWING = METHOD_VARIANT == 'THROWING'
242
242
% if IS_THROWING:
243
243
% FAILURE_TYPE = 'Error'
244
+ % THROWS = 'throws '
244
245
% else:
245
246
% FAILURE_TYPE = 'Never'
246
- % OPERATION_PARAM = OPERATION_PARAM.replace('throws', '')
247
+ % THROWS = ''
247
248
% end
248
249
249
250
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY && !SWIFT_CONCURRENCY_EMBEDDED
@@ -256,7 +257,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
256
257
@discardableResult
257
258
public static func startOnMainActor(
258
259
priority: TaskPriority? = nil,
259
- ${OPERATION_PARAM}
260
+ @_inheritActorContext @_implicitSelfCapture _ operation: __owned @Sendable @escaping @MainActor () async ${THROWS} -> Success
260
261
) -> Task<Success, ${FAILURE_TYPE}> {
261
262
let flags = taskCreateFlags(
262
263
priority: priority,
0 commit comments