// validType verifies that the given type does not "expand" indefinitely // producing a cycle in the type graph. // (Cycles involving alias types, as in "type A = [10]A" are detected // earlier, via the objDecl cycle detection mechanism.) func (check *Checker) validType(typ *Named) { … } // validType0 checks if the given type is valid. If typ is a type parameter // its value is looked up in the type argument list of the instantiated // (enclosing) type, if it exists. Otherwise the type parameter must be from // an enclosing function and can be ignored. // The nest list describes the stack (the "nest in memory") of types which // contain (or embed in the case of interfaces) other types. For instance, a // struct named S which contains a field of named type F contains (the memory // of) F in S, leading to the nest S->F. If a type appears in its own nest // (say S->F->S) we have an invalid recursive type. The path list is the full // path of named types in a cycle, it is only needed for error reporting. func (check *Checker) validType0(pos syntax.Pos, typ Type, nest, path []*Named) bool { … } // makeObjList returns the list of type name objects for the given // list of named types. func makeObjList(tlist []*Named) []Object { … }