@@ -190,7 +190,20 @@ public struct DiscardingTaskGroup {
190190#endif
191191
192192 // Create the task in this group.
193+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
193194 _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
195+ #else
196+ // This builtin happens to work, but the signature of the operation is
197+ // incorrect, as the discarding group uses Void, and therefore has less
198+ // generic parameters than the operation expected to be passed to
199+ // createAsyncTaskInGroup. While this happened to work on some platforms,
200+ // on others this causes issues, e.g. on wasm;
201+ //
202+ // Keep this branch for compatibility with old compilers, but use the
203+ // correct 'createAsyncDiscardingTaskInGroup' when available (and a recent
204+ // enough compiler is used).
205+ _ = Builtin . createAsyncTaskInGroup ( flags, _group, operation)
206+ #endif
194207 }
195208
196209 /// Adds a child task to the group, unless the group has been canceled.
@@ -231,7 +244,20 @@ public struct DiscardingTaskGroup {
231244#endif
232245
233246 // Create the task in this group.
247+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
234248 _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
249+ #else
250+ // This builtin happens to work, but the signature of the operation is
251+ // incorrect, as the discarding group uses Void, and therefore has less
252+ // generic parameters than the operation expected to be passed to
253+ // createAsyncTaskInGroup. While this happened to work on some platforms,
254+ // on others this causes issues, e.g. on wasm;
255+ //
256+ // Keep this branch for compatibility with old compilers, but use the
257+ // correct 'createAsyncDiscardingTaskInGroup' when available (and a recent
258+ // enough compiler is used).
259+ _ = Builtin . createAsyncTaskInGroup ( flags, _group, operation)
260+ #endif
235261
236262 return true
237263 }
@@ -247,7 +273,20 @@ public struct DiscardingTaskGroup {
247273 )
248274
249275 // Create the task in this group.
276+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
250277 _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
278+ #else
279+ // This builtin happens to work, but the signature of the operation is
280+ // incorrect, as the discarding group uses Void, and therefore has less
281+ // generic parameters than the operation expected to be passed to
282+ // createAsyncTaskInGroup. While this happened to work on some platforms,
283+ // on others this causes issues, e.g. on wasm;
284+ //
285+ // Keep this branch for compatibility with old compilers, but use the
286+ // correct 'createAsyncDiscardingTaskInGroup' when available (and a recent
287+ // enough compiler is used).
288+ _ = Builtin . createAsyncTaskInGroup ( flags, _group, operation)
289+ #endif
251290 }
252291
253292 /// Adds a child task to the group, unless the group has been canceled.
@@ -278,7 +317,20 @@ public struct DiscardingTaskGroup {
278317 )
279318
280319 // Create the task in this group.
320+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
281321 _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
322+ #else
323+ // This builtin happens to work, but the signature of the operation is
324+ // incorrect, as the discarding group uses Void, and therefore has less
325+ // generic parameters than the operation expected to be passed to
326+ // createAsyncTaskInGroup. While this happened to work on some platforms,
327+ // on others this causes issues, e.g. on wasm;
328+ //
329+ // Keep this branch for compatibility with old compilers, but use the
330+ // correct 'createAsyncDiscardingTaskInGroup' when available (and a recent
331+ // enough compiler is used).
332+ _ = Builtin . createAsyncTaskInGroup ( flags, _group, operation)
333+ #endif
282334
283335 return true
284336#else
@@ -564,7 +616,20 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
564616 )
565617
566618 // Create the task in this group.
619+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
567620 _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
621+ #else
622+ // This builtin happens to work, but the signature of the operation is
623+ // incorrect, as the discarding group uses Void, and therefore has less
624+ // generic parameters than the operation expected to be passed to
625+ // createAsyncTaskInGroup. While this happened to work on some platforms,
626+ // on others this causes issues, e.g. on wasm;
627+ //
628+ // Keep this branch for compatibility with old compilers, but use the
629+ // correct 'createAsyncDiscardingTaskInGroup' when available (and a recent
630+ // enough compiler is used).
631+ _ = Builtin . createAsyncTaskInGroup ( flags, _group, operation)
632+ #endif
568633#else
569634 fatalError ( " Unsupported Swift compiler " )
570635#endif
@@ -593,7 +658,20 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
593658 )
594659
595660 // Create the task in this group.
661+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
596662 _ = Builtin . createAsyncDiscardingTaskInGroup ( flags, _group, operation)
663+ #else
664+ // This builtin happens to work, but the signature of the operation is
665+ // incorrect, as the discarding group uses Void, and therefore has less
666+ // generic parameters than the operation expected to be passed to
667+ // createAsyncTaskInGroup. While this happened to work on some platforms,
668+ // on others this causes issues, e.g. on wasm;
669+ //
670+ // Keep this branch for compatibility with old compilers, but use the
671+ // correct 'createAsyncDiscardingTaskInGroup' when available (and a recent
672+ // enough compiler is used).
673+ _ = Builtin . createAsyncTaskInGroup ( flags, _group, operation)
674+ #endif
597675
598676 return true
599677#else
0 commit comments