Skip to content

Commit 3269a33

Browse files
committed
Use correct builtin for discarding task group creation in gyb file
1 parent 12c67c7 commit 3269a33

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

stdlib/public/Concurrency/TaskGroup+addTask.swift.gyb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ import Swift
143143
% HAS_TASK_EXECUTOR = any('taskExecutor:' in param for param in PARAMS)
144144
%
145145
% ARROW_RETURN_TYPE = "-> Bool " if IS_ADD_UNLESS_CANCELLED else ""
146+
%
147+
% if IS_DISCARDING:
148+
% TASK_CREATE_FN = 'Builtin.createDiscardingTask'
149+
% else:
150+
% TASK_CREATE_FN = 'Builtin.createTask'
151+
% end
146152

147153
% if IFDEF:
148154
#if ${IFDEF}
@@ -240,7 +246,7 @@ extension ${TYPE} {
240246
if var name {
241247
task =
242248
name.withUTF8 { nameBytes in
243-
Builtin.createTask(
249+
${TASK_CREATE_FN}(
244250
flags: flags,
245251
initialSerialExecutor: builtinSerialExecutor,
246252
taskGroup: _group,
@@ -256,7 +262,7 @@ extension ${TYPE} {
256262
% if HAS_TASK_EXECUTOR:
257263
if task == nil, let taskExecutor {
258264
#if $BuiltinCreateAsyncTaskOwnedTaskExecutor
259-
task = Builtin.createTask(
265+
task = ${TASK_CREATE_FN}(
260266
flags: flags,
261267
initialSerialExecutor: builtinSerialExecutor,
262268
taskGroup: _group,
@@ -267,7 +273,7 @@ extension ${TYPE} {
267273
let executorBuiltin: Builtin.Executor =
268274
taskExecutor.asUnownedTaskExecutor().executor
269275

270-
task = Builtin.createTask(
276+
task = ${TASK_CREATE_FN}(
271277
flags: flags,
272278
initialSerialExecutor: builtinSerialExecutor,
273279
taskGroup: _group,
@@ -279,7 +285,7 @@ extension ${TYPE} {
279285

280286
% # The baseline fallback, if no other create calls could be used
281287
if task == nil {
282-
task = Builtin.createTask(
288+
task = ${TASK_CREATE_FN}(
283289
flags: flags,
284290
initialSerialExecutor: builtinSerialExecutor,
285291
taskGroup: _group,
@@ -303,8 +309,3 @@ extension ${TYPE} {
303309
% end
304310
% end
305311
% end
306-
307-
// FIXME: The following sources should be in SourceCompatibilityShims.swift,
308-
// but the current build has trouble including the generated gyb sources
309-
// such that they are available to the same module. As we move to the
310-
// new build style we should resolve this. rdar://145171772

0 commit comments

Comments
 (0)