A potential ambiguity that was brought up in the previous discussion of variadic splatting involves variadic Any
:
func foo(_ x: Any...) {
print(x.count)
}
let a: [Any] = [0, 1, 2]
let b: Any = a as Any
foo(a) // 1 arg or 3?
foo(b) // 1 arg or 3?
foo([0, 1, 2]) // 1 arg or 3?
Currently, all 3 calls are legal, and they all pass in 1 argument. If we want to allow passing a collection (whether literal or variable) into a variadic, we need an answer for this situation.