From: Alan Donovan Date: Thu, 24 Jan 2013 19:21:51 +0000 (-0500) Subject: go/types: add String() method to Type interface. X-Git-Tag: go1.1rc2~1295 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f8fb95f288d54f7459d08e6b47bfa48e46b79315;p=gostls13.git go/types: add String() method to Type interface. All implementations delegate to typeString. Though I don't wish to exploit gri's absence to change his code, this change is pretty low-risk and he assented to it in the blue ink in the doc below [gophers only]. https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit# R=iant, gri, gri CC=golang-dev https://golang.org/cl/7200046 --- diff --git a/src/pkg/go/types/errors.go b/src/pkg/go/types/errors.go index 3fe0b29690..c8b420b4db 100644 --- a/src/pkg/go/types/errors.go +++ b/src/pkg/go/types/errors.go @@ -316,3 +316,16 @@ func writeType(buf *bytes.Buffer, typ Type) { fmt.Fprintf(buf, "", t) } } + +func (t *Array) String() string { return typeString(t) } +func (t *Basic) String() string { return typeString(t) } +func (t *Chan) String() string { return typeString(t) } +func (t *Interface) String() string { return typeString(t) } +func (t *Map) String() string { return typeString(t) } +func (t *NamedType) String() string { return typeString(t) } +func (t *Pointer) String() string { return typeString(t) } +func (t *Result) String() string { return typeString(t) } +func (t *Signature) String() string { return typeString(t) } +func (t *Slice) String() string { return typeString(t) } +func (t *Struct) String() string { return typeString(t) } +func (t *builtin) String() string { return typeString(t) } diff --git a/src/pkg/go/types/types.go b/src/pkg/go/types/types.go index 65daad5cfa..2107a20d16 100644 --- a/src/pkg/go/types/types.go +++ b/src/pkg/go/types/types.go @@ -8,6 +8,7 @@ import "go/ast" // All types implement the Type interface. type Type interface { + String() string aType() }