]> Cypherpunks repositories - gostls13.git/commit
go/parser: match const/var decl parsing of syntax package
authorRobert Griesemer <gri@golang.org>
Thu, 18 Aug 2022 23:42:28 +0000 (16:42 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 19 Aug 2022 19:39:48 +0000 (19:39 +0000)
commit9a1d3b0ad20ba5d73ba3a88c86563ae7b4cf03ca
tree45cf501b7e9c5259224dd40dab13b15f3cc49d54
parentbc69ad3a77129cd4cf4d3bdaa592dfc95ff8c769
go/parser: match const/var decl parsing of syntax package

Use same approach to parsing const and var declarations
as the syntax package. Specifically, don't complain if
the first const specification in a const declaration
doesn't have a type and initialization expression. This
removes some duplicate errors when combined with the
type checker.

Adjust corresponding type checker tests accordingly.

For #54511.

Change-Id: I96702eba51dda6b581dad44577a7f93e4c02c857
Reviewed-on: https://go-review.googlesource.com/c/go/+/424904
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
src/go/parser/parser.go
src/go/parser/short_test.go
src/go/types/testdata/check/constdecl.go
src/go/types/testdata/check/vardecl.go