Is `sending` supported by variadic generics?

I am trying to transfer non-sendable variadic generics values to a function through the sending keyword. However, I don't seem to be able to use it correctly.

struct Runner {
  func run<each Value>(_ value: repeat each Value) async {
    // Some code here potentially transferring values as well
  }
}

Where should I place the sending keyword? Is it supported at all? I can crash the compiler fairly easily depending on the placement of the keyword.

2 Likes

The parameter packs implementation hasn’t yet caught up with the fancier things you can do with function parameters, such as inout, ownership modifiers, ~Copyable or sending.

There are some common issues in the parser with parsing these specifiers in conjunction with repeat which should be easy to resolve, then we can at least diagnose the unsupported cases in a clean way.

Implementing the semantics for each one is of course a separate project in itself.

12 Likes

I've run into problems here as well. Please do file bugs, especially if you can cause a crash! Here are some of mine:

3 Likes

That is good to know. Thank you @Slava_Pestov

That is a good point @mattie. Thank you for the remainder. Here it is.

1 Like