// with the first type in result signature (there may
// be more than one result)
factoryType := res.Type
- if t, ok := factoryType.(*ast.ArrayType); ok && t.Len == nil {
- // We consider functions that return slices of type T (or
- // pointers to T) as factory functions of T.
+ if t, ok := factoryType.(*ast.ArrayType); ok {
+ // We consider functions that return slices or arrays of type
+ // T (or pointers to T) as factory functions of T.
factoryType = t.Elt
}
if n, imp := baseTypeName(factoryType); !imp && r.isVisible(n) {
//
-PACKAGE issue18063
+PACKAGE issue22856
IMPORTPATH
- testdata/issue18063
+ testdata/issue22856
FILENAMES
- testdata/issue18063.go
+ testdata/issue22856.go
FUNCTIONS
- // NewArray is not a factory function because arrays of type T are ...
- func NewArray() [1]T
-
- // NewPointerArray is not a factory function because arrays of ...
- func NewPointerArray() [1]*T
-
// NewPointerSliceOfSlice is not a factory function because slices ...
func NewPointerSliceOfSlice() [][]*T
//
func New() T
+ //
+ func NewArray() [1]T
+
//
func NewPointer() *T
+ //
+ func NewPointerArray() [1]*T
+
//
func NewPointerOfPointer() **T
//
-PACKAGE issue18063
+PACKAGE issue22856
IMPORTPATH
- testdata/issue18063
+ testdata/issue22856
FILENAMES
- testdata/issue18063.go
+ testdata/issue22856.go
FUNCTIONS
- // NewArray is not a factory function because arrays of type T are ...
- func NewArray() [1]T
-
- // NewPointerArray is not a factory function because arrays of ...
- func NewPointerArray() [1]*T
-
// NewPointerSliceOfSlice is not a factory function because slices ...
func NewPointerSliceOfSlice() [][]*T
//
func New() T
+ //
+ func NewArray() [1]T
+
//
func NewPointer() *T
+ //
+ func NewPointerArray() [1]*T
+
//
func NewPointerOfPointer() **T
//
-PACKAGE issue18063
+PACKAGE issue22856
IMPORTPATH
- testdata/issue18063
+ testdata/issue22856
FILENAMES
- testdata/issue18063.go
+ testdata/issue22856.go
FUNCTIONS
- // NewArray is not a factory function because arrays of type T are ...
- func NewArray() [1]T
-
- // NewPointerArray is not a factory function because arrays of ...
- func NewPointerArray() [1]*T
-
// NewPointerSliceOfSlice is not a factory function because slices ...
func NewPointerSliceOfSlice() [][]*T
//
func New() T
+ //
+ func NewArray() [1]T
+
//
func NewPointer() *T
+ //
+ func NewPointerArray() [1]*T
+
//
func NewPointerOfPointer() **T
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package issue18063
+package issue22856
type T struct{}
func NewPointerSlice() []*T { return []*T{&T{}} }
func NewSlice() []T { return []T{T{}} }
func NewPointerOfPointer() **T { x := &T{}; return &x }
-
-// NewArray is not a factory function because arrays of type T are not
-// factory functions of type T.
-func NewArray() [1]T { return [1]T{T{}} }
-
-// NewPointerArray is not a factory function because arrays of type *T are not
-// factory functions of type T.
-func NewPointerArray() [1]*T { return [1]*T{&T{}} }
+func NewArray() [1]T { return [1]T{T{}} }
+func NewPointerArray() [1]*T { return [1]*T{&T{}} }
// NewSliceOfSlice is not a factory function because slices of a slice of
// type *T are not factory functions of type T.