go.tools/go/types: documentation follow-up
Added documentation per request in https://golang.org/cl/108230044 . LGTM=adonovan R=adonovan CC=golang-codereviews https://golang.org/cl/137620044
This commit is contained in:
parent
f13b4c029c
commit
9dcf670d50
|
|
@ -200,7 +200,7 @@ type Signature struct {
|
|||
recv *Var // nil if not a method
|
||||
params *Tuple // (incoming) parameters from left to right; or nil
|
||||
results *Tuple // (outgoing) results from left to right; or nil
|
||||
variadic bool // true if the last parameter's type is of the form ...T
|
||||
variadic bool // true if the last parameter's type is of the form ...T (or string, for append built-in only)
|
||||
}
|
||||
|
||||
// NewSignature returns a new function type for the given receiver, parameters,
|
||||
|
|
|
|||
|
|
@ -221,6 +221,11 @@ func writeTuple(buf *bytes.Buffer, this *Package, tup *Tuple, variadic bool, vis
|
|||
buf.WriteString("...")
|
||||
typ = s.elem
|
||||
} else {
|
||||
// special case:
|
||||
// append(s, "foo"...) leads to signature func([]byte, string...)
|
||||
if t, ok := typ.Underlying().(*Basic); !ok || t.kind != String {
|
||||
panic("internal error: string type expected")
|
||||
}
|
||||
writeType(buf, this, typ, visited)
|
||||
buf.WriteString("...")
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in New Issue