// expected: method receiver must name the type's type parameters // // A method goes on the defined generic type, with a receiver that names its // type parameters: func (t *table[K, V]) scan(). A receiver that carries an // INSTANTIATION - func (t *table[string, *node]) scan() - is not a method // declaration: the field offsets of a generic type are only known per // instantiation, and Go rejects it for the same reason ("receiver type // parameter *node must be an identifier"). package main type pair[K comparable, V comparable] struct { key K value V } type table[K comparable, V comparable] struct { rows []pair[K, V] } type node struct { name string hits int32 } func (t *table[string, *node]) scan(want string) (name string, hits int32) { return } func main() { select { case <-shutdown: return default: } var t *table[string, *node] name, _ := t.scan("x") println(name) }