Ran into this and I was wondering if it was a bug or not. Assuming "Foo" is an interface with a function of "Bar", then the following function should have a type reference of T and a pointer reference of P that implements the Foo interface, and is bound to the Type of T (
func Update[T any, P interface {
Foo
*T
}]() {
Inside that function :
var t T; t.Bar() // gives
t.Bar undefined (type T has no field or method Bar)
var t T; i:= &t; i.Bar() // Gives
i.Bar undefined (type *T is pointer to type parameter, not type parameter)
But the following passes compile, and creates a new instance of type T, with "i" being the pointer to it.
var t T; var i P; i= &t; i.Bar() // Pass
IMO all three ways should work, but curious as to why they don't
Thanks
Nz