1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package types2 6 7 // A Slice represents a slice type. 8 type Slice struct { 9 elem Type 10 } 11 12 // NewSlice returns a new slice type for the given element type. 13 func NewSlice(elem Type) *Slice { return &Slice{elem: elem} } 14 15 // Elem returns the element type of slice s. 16 func (s *Slice) Elem() Type { return s.elem } 17 18 func (s *Slice) Underlying() Type { return s } 19 func (s *Slice) String() string { return TypeString(s, nil) } 20