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
{{ message }}
Repository navigation
cmd/compile: Inconsistent type argument inference between generic functions and generic types #78875
./prog.go:9:6: not enough type arguments for type t_not_ok_inference: have 1, want 2
What did you expect to see?
Compile success.
There appears to be an inconsistency in how type argument inference works for generic functions versus generic types when one type parameter is constrained as a pointer to another.
The compiler allows partial type argument specification with inference for generic functions, but rejects the same pattern for generic types.
This is an interesting example of a type inference problem.
Although we need to look at the docs, and whether there are any restrictions on type inference in interfaces and structures.
And maybe you'll be interested. Also we collect the problems of type inference here: #73527
Activity
mwriter commentedon Apr 20, 2026
This is an interesting example of a type inference problem.
Although we need to look at the docs, and whether there are any restrictions on type inference in interfaces and structures.
And maybe you'll be interested. Also we collect the problems of type inference here:
#73527
seankhliao commentedon Apr 20, 2026
see the spec:
inference is only for functions: https://go.dev/ref/spec#Type_inference