Open
Description
Description
When a type with a parameter pack returns a new type with a parameter pack, the type checking appears to fail to resolve the type when chained into another call.
Reproduction
struct S<T, each U> {
func combine<V, each W>(_ other: S<V, repeat each W>) -> S<T, repeat each U, V, repeat each W> {
fatalError()
}
func inspect(_: (T, repeat each U) -> Void) -> Self {
self
}
}
func f() {
S<Int>().inspect { print($0) }
let s1 = S<Int>()
s1.inspect { print($0) }
// ✅ This works
let s2 = S<Int>().combine(S<Double>())
s2.inspect { print($0, $1) }
// 🛑 Could not infer pack element #0 from context
// 🛑 Could not infer pack element #1 from context
// 🛑 Could not infer pack element #2 from context
S<Int>().combine(S<Double>()).inspect { print($0, $1) }
}
Expected behavior
I expect the line to compile since it's just combining the statements before it into a single expression
Environment
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Additional information
No response