Closed
Description
Proposal Details
The expression f.Type().(*types.Signature)
, where f is a *types.Func
, appears over a hundred times in x/tools. Each time I read it, I am momentarily compelled to prove a little theorem that the type assertion is sound.
For brevity, convenience, and simplicity, I propose that we add this method to go/types
:
// Signature returns the signature (type) of the function or method.
func (f *Func) Signature() *Signature {
return f.Type().(*types.Signature)
}