File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2982,6 +2982,12 @@ namespace {
29822982 ->mapTypeIntoContext (decl->getInterfaceType ())
29832983 ->getReferenceStorageReferent ();
29842984
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+
29852991 if (type->hasError ())
29862992 continue ;
29872993
Original file line number Diff line number Diff line change @@ -507,3 +507,23 @@ func checkOpaqueType() -> some Sendable {
507507class MainActorSub : MainActorSuper < MainActorSub . Nested > {
508508 struct Nested { } // no cycle
509509}
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+ @available ( SwiftStdlib 5 . 1 , * )
529+ func sendPack< each Element > ( _: repeat each Element ) async { }
You can’t perform that action at this time.
0 commit comments