Closed
Description
package main
type A struct{}
type B struct{}
var a A
var b B
var c struct{}
func main() {
f(a, b, c) // ERROR "type B of b does not match inferred type A for P"
f[struct{}](a, b, c)
}
func f[P any](...P) {}
fails to infer the type argument struct{}
even though it appears in the function argument list (playground).
This bug existed since Go 1.18.
It partly interferes with a fix for #62157 (we can't fully fix #62157 without addressing this issue as well).
cc: @findleyr