Existential unexpectedly enables splatting behavior with variadic parameter #73925
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
type checker
Area → compiler: Semantic analysis
variadic parameters
Feature → declarations → function parameters: Variadic function parameters
Description
Consider the following error:
This behavior is deliberate, and there exists no splatting operator to enabling forwarding
y
as variadic arguments instead of a single argument—or is there?Consider the following generic functions:
This behavior is correct:
y
is passed as a single argument of type[Int]
tofoo2
. But now consider the following functions that take existential arguments:By using an existential, we have unexpectedly enabled a splatting behavior that is not documented (or, afaict, intended).
Discussed in https://forums.swift.org/t/variadic-parameters-passing/72080/13
Reproduction
Expected behavior
Prints "1 variadic argument(s) to 'foo3'" instead
Environment
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-darwin23.3.0
Additional information
No response
The text was updated successfully, but these errors were encountered: