You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
typeAstruct{}
typeBstruct{}
varaAvarbBvarcstruct{}
funcmain() {
f(a, b, c) // ERROR "type B of b does not match inferred type A for P"f[struct{}](a, b, c)
}
funcf[Pany](...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).
griesemer
changed the title
go/types, types2: type inference fails to infer underlying type in simple case
go/types, types2: type inference fails to infer type argument even though correct type is present in argument list
Aug 28, 2023
Per internal discussion: we're not going to change behavior here. If f(a, c) infers A, f(b, c) infers B, and f(a, b) fails, then f(a, b, c) is ok to fail; i.e., the type argument C must be provided explicitly.
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
The text was updated successfully, but these errors were encountered: