Open
Description
Description
All credit to Matt Curtis for reducing this issue to the following:
func write<T>(_ value: T) { } // 1
func write<each T>(_ values: (repeat each T)) { } // 2
write(1) // Ambiguous use of 'write'
If (2) were instead written so as not to wrap the parameter pack in a tuple, it would be disfavored by today's compiler. But when wrapped in a tuple as here, the compiler complains of ambiguity. The discrepancy isn't really justified, and (1) should be considered "more specific" than (2).
For more see https://forums.swift.org/t/non-copyable-types-and-function-overload-resolution/80383/4
Reproduction
func write<T>(_ value: T) { } // 1
func write<each T>(_ values: (repeat each T)) { } // 2
write(1) // Ambiguous use of 'write'
Expected behavior
Expect invocation of first overload
Environment
Swift 6.1
Additional information
No response