File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2982,6 +2982,12 @@ namespace {
2982
2982
->mapTypeIntoContext (decl->getInterfaceType ())
2983
2983
->getReferenceStorageReferent ();
2984
2984
2985
+ // Pack expansions are okay to capture as long as the pattern
2986
+ // type is Sendable.
2987
+ if (auto *expansion = type->getAs <PackExpansionType>()) {
2988
+ type = expansion->getPatternType ();
2989
+ }
2990
+
2985
2991
if (type->hasError ())
2986
2992
continue ;
2987
2993
Original file line number Diff line number Diff line change @@ -507,3 +507,22 @@ func checkOpaqueType() -> some Sendable {
507
507
class MainActorSub : MainActorSuper < MainActorSub . Nested > {
508
508
struct Nested { } // no cycle
509
509
}
510
+
511
+ @available ( SwiftStdlib 5 . 9 , * )
512
+ struct SendablePack < each Element : Sendable > : Sendable {
513
+ let elements : ( repeat each Element )
514
+ }
515
+
516
+ @available ( SwiftStdlib 5 . 1 , * )
517
+ @MainActor
518
+ func sendablePacks< each Element : Sendable > (
519
+ _ element: repeat each Element
520
+ ) async {
521
+ { @Sendable in
522
+ repeat _ = each element
523
+ } ( )
524
+
525
+ await sendPack ( repeat each element)
526
+ }
527
+
528
+ func sendPack< each Element > ( _: repeat each Element ) async { }
You can’t perform that action at this time.
0 commit comments