]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: add String() method to Type interface.
authorAlan Donovan <adonovan@google.com>
Thu, 24 Jan 2013 19:21:51 +0000 (14:21 -0500)
committerAlan Donovan <adonovan@google.com>
Thu, 24 Jan 2013 19:21:51 +0000 (14:21 -0500)
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

src/pkg/go/types/errors.go
src/pkg/go/types/types.go

index 3fe0b29690523a0f8e2dec4f8095baef0dbd6392..c8b420b4db6939b2b546446371e1e8caacc40ef7 100644 (file)
@@ -316,3 +316,16 @@ func writeType(buf *bytes.Buffer, typ Type) {
                fmt.Fprintf(buf, "<type %T>", 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) }
index 65daad5cfa6d7c169026b99e1fc37cde147bcc26..2107a20d16fc48ea53e82ce50fff61b9ce0b5021 100644 (file)
@@ -8,6 +8,7 @@ import "go/ast"
 
 // All types implement the Type interface.
 type Type interface {
+       String() string
        aType()
 }