type Signature … // NewSignatureType creates a new function type for the given receiver, // receiver type parameters, type parameters, parameters, and results. If // variadic is set, params must hold at least one parameter and the last // parameter's core type must be of unnamed slice or bytestring type. // If recv is non-nil, typeParams must be empty. If recvTypeParams is // non-empty, recv must be non-nil. func NewSignatureType(recv *Var, recvTypeParams, typeParams []*TypeParam, params, results *Tuple, variadic bool) *Signature { … } // Recv returns the receiver of signature s (if a method), or nil if a // function. It is ignored when comparing signatures for identity. // // For an abstract method, Recv returns the enclosing interface either // as a *[Named] or an *[Interface]. Due to embedding, an interface may // contain methods whose receiver type is a different interface. func (s *Signature) Recv() *Var { … } // TypeParams returns the type parameters of signature s, or nil. func (s *Signature) TypeParams() *TypeParamList { … } // RecvTypeParams returns the receiver type parameters of signature s, or nil. func (s *Signature) RecvTypeParams() *TypeParamList { … } // Params returns the parameters of signature s, or nil. func (s *Signature) Params() *Tuple { … } // Results returns the results of signature s, or nil. func (s *Signature) Results() *Tuple { … } // Variadic reports whether the signature s is variadic. func (s *Signature) Variadic() bool { … } func (s *Signature) Underlying() Type { … } func (s *Signature) String() string { … } // funcType type-checks a function or method type. func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []*syntax.Field, ftyp *syntax.FuncType) { … } // collectRecv extracts the method receiver and its type parameters (if any) from rparam. // It declares the type parameters (but not the receiver) in the current scope, and // returns the receiver variable and its type parameter list (if any). func (check *Checker) collectRecv(rparam *syntax.Field, scopePos syntax.Pos) (recv *Var, recvTParamsList *TypeParamList) { … } // recordParenthesizedRecvTypes records parenthesized intermediate receiver type // expressions that all map to the same type, by recursively unpacking expr and // recording the corresponding type for it. Example: // // expression --> type // ---------------------- // (*(T[P])) *T[P] // *(T[P]) *T[P] // (T[P]) T[P] // T[P] T[P] func (check *Checker) recordParenthesizedRecvTypes(expr syntax.Expr, typ Type) { … } // collectParams collects (but does not declare) all parameters of list and returns // the list of parameter names, corresponding parameter variables, and whether the // parameter list is variadic. Anonymous parameters are recorded with nil names. func (check *Checker) collectParams(list []*syntax.Field, variadicOk bool) (names []*syntax.Name, params []*Var, variadic bool) { … } // declareParams declares each named parameter in the current scope. func (check *Checker) declareParams(names []*syntax.Name, params []*Var, scopePos syntax.Pos) { … } // validRecv verifies that the receiver satisfies its respective spec requirements // and reports an error otherwise. If hasTypeParams is set, the receiver declares // type parameters. func (check *Checker) validRecv(recv *Var, hasTypeParams bool) { … }