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:
Robert Griesemer 2014-09-15 11:32:39 -07:00
parent f13b4c029c
commit 9dcf670d50
2 changed files with 6 additions and 1 deletions

View File

@ -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,

View File

@ -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