Variadic Generic type extension


I am trying the new VariadicGenerics experimental feature and I struggle to do something.

struct Foo<T, each V> {


protocol SimpleFoo {
 // ...

// here I'm trying to extend Foo when V = Pack{} ie Self is Foo<T>
extension Foo where ??? {
  // Implement conformance to SimpleFoo

I tried various variants but I didn't found one that is accepted.
The most obvious to me was: where (repeat each V) == ()

Is it possible and I missed the way to do it ?
Is it a limitation of the current implementation ?
Will it be possible in the future ?

Thank you for your help

Your intuition is correct, and we plan on allowing this kind of requirement soon, but it's not implemented yet.


Great ! Thank you for the quick answer :slight_smile:

@Slava_Pestov I encountered several crashes or type checking failure continuing to test this feature.

As it is still in development, should I report the crashes / failure on Github if I manage to reproduce in a sample code ? I don't want to add too much noise on a feature still in development

Please report the crashes!

1 Like

@Slava_Pestov Forgot to mention it her, I filled a report a few weeks ago for a crash : Crash at compilation when calling variadic generic function using pack expansion as argument · Issue #67645 · apple/swift · GitHub

Took me some time to isolate the crash in a bigger codebase.