]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile/internal/syntax: don't panic when providing -verify
authorRobert Griesemer <gri@golang.org>
Wed, 16 Dec 2020 05:55:28 +0000 (21:55 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 16 Dec 2020 18:41:38 +0000 (18:41 +0000)
commit068dd0470bb796f9497d3d069c0f3208fd4dda36
treea26755230d9ba3a69d9aaf3f73f807258485ef2a
parent7909d6ec284da0e6a45bdf8fc2afdbb8bbcaeec2
[dev.typeparams] cmd/compile/internal/syntax: don't panic when providing -verify

The -verify flag is used to verify idempotent printing of syntax
trees. While syntax tree printing is not actively used at the
moment, the verification code still shouldn't panic.

Fixed the cause for the panic (after reading from a bytes.Buffer
that buffer is empty and so doesn't compare to the unread buffer),
and replaced the panic with a test error.

Added a test that makes sure the code invoked by -verify is run.

Change-Id: I38634ed7cfa8668deb0ea2ee9fb74a8f86cfc195
Reviewed-on: https://go-review.googlesource.com/c/go/+/278477
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/syntax/parser_test.go