Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter pack type cannot be Sendable? #74484

Open
mattmassicotte opened this issue Jun 17, 2024 · 0 comments
Open

Parameter pack type cannot be Sendable? #74484

mattmassicotte opened this issue Jun 17, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features parameter packs Feature → generics: Parameter packs

Comments

@mattmassicotte
Copy link
Contributor

Description

Having a hard time figuring out how to make parameter pack types Sendable.

error: capture of 'parameters' with non-sendable type 'repeat each ParameterType' in a `@Sendable` closure
 5 | ) -> @Sendable () async -> Void where repeat each ParameterType: Sendable {
 6 |     {
 7 |         await effect(repeat each parameters)
   |                                  `- error: capture of 'parameters' with non-sendable type 'repeat each ParameterType' in a `@Sendable` closure
 8 |     }
 9 | }

Reproduction

func doThing<each ParameterType: Sendable>(
    _ effect: @Sendable @escaping (repeat each ParameterType) async -> Void,
    with parameters: repeat each ParameterType
) -> @Sendable () async -> Void {
    {
        await effect(repeat each parameters)
    }
}

Expected behavior

This should compile without error.

Environment

Apple Swift version 6.0-dev (LLVM bf8bbb910874156, Swift a0bb875)
Target: arm64-apple-macosx14.0

Additional information

No response

@mattmassicotte mattmassicotte added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Jun 17, 2024
@hborla hborla added concurrency Feature: umbrella label for concurrency language features parameter packs Feature → generics: Parameter packs and removed triage needed This issue needs more specific labels labels Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features parameter packs Feature → generics: Parameter packs
Projects
None yet
Development

No branches or pull requests

2 participants