]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] go/parser: error for type instances without ParseTypeParams
authorRob Findley <rfindley@google.com>
Fri, 15 Jan 2021 16:08:02 +0000 (11:08 -0500)
committerRobert Findley <rfindley@google.com>
Tue, 19 Jan 2021 21:28:51 +0000 (21:28 +0000)
commit958927c8249fc7e073ffa5e5f0a8f7d3498b5616
treeca741fdb26b8ee61e237f640075ce81400f87236
parent90bfc7307175c2f58d4efb48003670dba23385ed
[dev.typeparams] go/parser: error for type instances without ParseTypeParams

It should be an invariant that the parser does not produce ast.CallExprs
with Brackets == true unless parsing with ParseTypeParams.

Fix the one case where this invariant was violated, and add a test for
errors produced in valid generic code when ParseTypeParams is unset. We
did have some coverage of errors in short_test.go, but I find them to be
easier to read in a testdata file and would like to gradually migrate
them there.

Change-Id: If2d174377087daa1b820cabc2b5bf8bcb0b39d8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/284192
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
src/go/parser/parser.go
src/go/parser/testdata/typeparams.src [new file with mode: 0644]