Variadic initializers can't be default initializers?

Here's my code:

extension MyType: SetAlgebra {
  //...

  public init<each S: StringProtocol>(_ string: repeat each S) {
    var result = [String]()
    for s in repeat each string {
      result.append(s.decomposedStringWithCanonicalMapping)
    }
    self.init(result, alreadyDecomposed: true)
  }
}

The compiler wouldn't accept the zero-argument version of this method to satisfy the default initializer requirement. Am I missing something, or is this some sort of whoops over coverage?

1 Like

I kind of mis-worded it. My case doesn't involve default argument values at all. In the past, we had issues where enumeration cases couldn't fill in something expecting a type-level property, although they have the same user interaction model. Variadic members should be able to satisfy requirements if one of their variations can match.

That article says it should work!

  • Generic functions can satisfy non-generic protocol requirements

Or is it just non-variadic generic functions?

Now at Variadic generic member functions can't satisfy protocol requirements. #89120