]> Cypherpunks repositories - gostls13.git/commit
go/doc: classify function returning slice or array of T as constructor
authorThomas Wanielista <tomwans@gmail.com>
Fri, 22 Dec 2017 21:17:56 +0000 (16:17 -0500)
committerRobert Griesemer <gri@golang.org>
Tue, 12 Jun 2018 16:37:37 +0000 (16:37 +0000)
commitadeb7e640b04526c38c481aff85b923ca14fc92b
treeee8fd5153409d0a22b1282c51bfb17773563b4e7
parentf027d1a8782387fb7e354054a669a202524335e4
go/doc: classify function returning slice or array of T as constructor

Previously, go/doc would only consider functions and slices that
return types of T or any number of pointers to T: *T, **T, etc. This
change expands the definition of a constructor to include functions
that return arrays of a type (or pointer to that type) in its first
return.

With this change, the following return types also classify a function
as a constructor of type T:

[1]T
[1]*T
[1]**T
(and so on)

Fixes #22856.

Change-Id: I37957c5f2d6a7b2ceeb3fbaef359057f2039393d
Reviewed-on: https://go-review.googlesource.com/85355
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/doc/reader.go
src/go/doc/testdata/issue22856.0.golden [moved from src/go/doc/testdata/issue18063.0.golden with 73% similarity]
src/go/doc/testdata/issue22856.1.golden [moved from src/go/doc/testdata/issue18063.1.golden with 73% similarity]
src/go/doc/testdata/issue22856.2.golden [moved from src/go/doc/testdata/issue18063.2.golden with 73% similarity]
src/go/doc/testdata/issue22856.go [moved from src/go/doc/testdata/issue18063.go with 74% similarity]