// expected: has no field or method // // A method that does not exist on the element of an instantiated generic must // still be rejected. Resolving the forward-declared generic's field type (see // should_compile/generic_forward_field.mx) must not turn a missing method into // a call the compiler silently drops. package main type mapping[K comparable, V comparable] struct { s []entry[K, V] } type entry[K comparable, V comparable] struct { key K value V } type node struct { name string } func (n *node) match(want string) (got *node, ok bool) { return nil, false } type tree struct { children mapping[string, *node] } func (t *tree) scan(want string) (n int32) { for _, e := range t.children.s { mp, _ := e.value.mismatch(want) if mp != nil { n = n + 1 } } return n } func main() { t := &tree{} t.children.s = []entry[string, *node]{} t.scan("a") }