aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/printer_test.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-08-26 14:52:32 -0700
committerRobert Griesemer <gri@golang.org>2021-08-27 05:13:44 +0000
commit2c60a99f723e779a39664b5f12cb41878fd4a700 (patch)
treeeee72c2e467d94b888fde53f89258f2679baf3f4 /src/cmd/compile/internal/syntax/printer_test.go
parentd350a6653252fe1f698ac00be99964fa31d06e89 (diff)
downloadgo-2c60a99f723e779a39664b5f12cb41878fd4a700.tar.gz
go-2c60a99f723e779a39664b5f12cb41878fd4a700.zip
cmd/compile/internal/syntax: make valid type parameter list in presence of errors
Make sure the parser fills in names and types for type parameter lists, even in the case of errors. While at it, adjust some of the test functions to accept generic code and report all syntax errors. Added offending source as test for types2. Fixes #47996. Change-Id: I449bcf5e2cb80fa2a24cdd3945f484bfca218a06 Reviewed-on: https://go-review.googlesource.com/c/go/+/345476 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax/printer_test.go')
-rw-r--r--src/cmd/compile/internal/syntax/printer_test.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/syntax/printer_test.go b/src/cmd/compile/internal/syntax/printer_test.go
index ec4b1de573..638e6d4a9d 100644
--- a/src/cmd/compile/internal/syntax/printer_test.go
+++ b/src/cmd/compile/internal/syntax/printer_test.go
@@ -18,11 +18,7 @@ func TestPrint(t *testing.T) {
t.Skip("skipping test in short mode")
}
- // provide a no-op error handler so parsing doesn't stop after first error
- ast, err := ParseFile(*src_, func(error) {}, nil, 0)
- if err != nil {
- t.Error(err)
- }
+ ast, _ := ParseFile(*src_, func(err error) { t.Error(err) }, nil, AllowGenerics)
if ast != nil {
Fprint(testOut(), ast, LineForm)