diff --git a/go/types/type.go b/go/types/type.go index a0c4e5ee..4b4e5f68 100644 --- a/go/types/type.go +++ b/go/types/type.go @@ -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, diff --git a/go/types/typestring.go b/go/types/typestring.go index 0b5e87be..9a537e81 100644 --- a/go/types/typestring.go +++ b/go/types/typestring.go @@ -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