]> Cypherpunks.ru repositories - gostls13.git/commit
go/parser: better error messages for incorrect type parameter list
authorRobert Griesemer <gri@golang.org>
Tue, 31 Oct 2023 21:22:05 +0000 (14:22 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 2 Nov 2023 12:56:53 +0000 (12:56 +0000)
commit285ac5a11e36ca4d85a7e97c9040a1e3de0ecc11
tree51c684ab5a10f0569163ffe6e2413d8085dabf37
parent54452b963c16834935b0589897b9ced9c4066a0d
go/parser: better error messages for incorrect type parameter list

This is a port of CL 538856 from the syntax parser to go/parser.
As part of the port, make more portions of parseParameterList
matching the equivalent paramList method (from the syntax parser).
As a result, this now also produces a better error message in cases
where the missing piece might not be a type parameter name but a
constraint (this fixes a TODO in a test).

Improve comments in the code and adjust the corresponding comments
in the syntax parser.

Change references to issues to use the format go.dev/issue/ddddd.

For #60812.

Change-Id: Ia243bd78161ed8543d3dc5deb20ca4a215c5b1e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/538858
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
14 files changed:
src/cmd/compile/internal/syntax/parser.go
src/go/parser/parser.go
src/go/parser/parser_test.go
src/go/parser/resolver.go
src/go/parser/short_test.go
src/go/parser/testdata/issue11377.src
src/go/parser/testdata/issue23434.src
src/go/parser/testdata/issue3106.src
src/go/parser/testdata/issue34946.src
src/go/parser/testdata/issue44504.src
src/go/parser/testdata/issue49175.go2
src/go/parser/testdata/resolution/typeparams.go2
src/go/parser/testdata/tparams.go2
src/go/parser/testdata/typeset.go2