aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/typelists.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/types2/typelists.go')
-rw-r--r--src/cmd/compile/internal/types2/typelists.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/typelists.go b/src/cmd/compile/internal/types2/typelists.go
index 3258a5e9f8..c3befb077f 100644
--- a/src/cmd/compile/internal/types2/typelists.go
+++ b/src/cmd/compile/internal/types2/typelists.go
@@ -4,6 +4,8 @@
package types2
+import "bytes"
+
// TParamList holds a list of type parameters.
type TParamList struct{ tparams []*TypeParam }
@@ -52,6 +54,17 @@ func (l *TypeList) list() []Type {
return l.types
}
+func (l *TypeList) String() string {
+ if l == nil || len(l.types) == 0 {
+ return "[]"
+ }
+ var buf bytes.Buffer
+ buf.WriteByte('[')
+ writeTypeList(&buf, l.types, nil, nil)
+ buf.WriteByte(']')
+ return buf.String()
+}
+
// ----------------------------------------------------------------------------
// Implementation