@@ -190,7 +190,20 @@ public struct DiscardingTaskGroup {
190
190
#endif
191
191
192
192
// Create the task in this group.
193
+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
193
194
_ = 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
194
207
}
195
208
196
209
/// Adds a child task to the group, unless the group has been canceled.
@@ -231,7 +244,20 @@ public struct DiscardingTaskGroup {
231
244
#endif
232
245
233
246
// Create the task in this group.
247
+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
234
248
_ = 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
235
261
236
262
return true
237
263
}
@@ -247,7 +273,20 @@ public struct DiscardingTaskGroup {
247
273
)
248
274
249
275
// Create the task in this group.
276
+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
250
277
_ = 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
251
290
}
252
291
253
292
/// Adds a child task to the group, unless the group has been canceled.
@@ -278,7 +317,20 @@ public struct DiscardingTaskGroup {
278
317
)
279
318
280
319
// Create the task in this group.
320
+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
281
321
_ = 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
282
334
283
335
return true
284
336
#else
@@ -564,7 +616,20 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
564
616
)
565
617
566
618
// Create the task in this group.
619
+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
567
620
_ = 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
568
633
#else
569
634
fatalError ( " Unsupported Swift compiler " )
570
635
#endif
@@ -593,7 +658,20 @@ public struct ThrowingDiscardingTaskGroup<Failure: Error> {
593
658
)
594
659
595
660
// Create the task in this group.
661
+ #if $BuiltinCreateAsyncDiscardingTaskInGroup
596
662
_ = 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
597
675
598
676
return true
599
677
#else
0 commit comments