]> Cypherpunks repositories - gostls13.git/commit
go/doc: fix constant type propagation
authorgriesemer <gri@golang.org>
Fri, 6 Oct 2017 00:03:53 +0000 (17:03 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 9 Oct 2017 18:01:14 +0000 (18:01 +0000)
commitd4023430fd77cd6c3ee97aa4ba9f4153427c8a8f
tree88fe3bb15e2458aa02a20c66d9ec53915884117f
parent1ddacfea7ba35c5ecbe75b2598c92f6349011ba3
go/doc: fix constant type propagation

The old code was seriously broken: It assumed that a constant
declaration without a type would always inherit the type of
the previous declaration, but in fact it only inherits the
type of the previous declaration when there's no type and no
constant value.

While fixing this bug, found that the result was not sorted
deterministically in all situations due to a poor choice of
order value (which led to spurious test failures since the
tests assume deterministic outputs). Fixed that as well.

Added new test cases and fixed some old (broken) tests.

Fixes #16153.

Change-Id: I95b480e019b0fd3538638caba02fe651c69e0513
Reviewed-on: https://go-review.googlesource.com/68730
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/doc/exports.go
src/go/doc/reader.go
src/go/doc/testdata/blank.0.golden
src/go/doc/testdata/blank.1.golden
src/go/doc/testdata/blank.2.golden
src/go/doc/testdata/blank.go
src/go/doc/testdata/issue16153.0.golden [new file with mode: 0644]
src/go/doc/testdata/issue16153.1.golden [new file with mode: 0644]
src/go/doc/testdata/issue16153.2.golden [new file with mode: 0644]
src/go/doc/testdata/issue16153.go [new file with mode: 0644]