aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/parser_test.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2016-10-31 16:58:15 -0700
committerRobert Griesemer <gri@golang.org>2016-11-01 05:18:47 +0000
commit7a26d9fcedd94a1ba0d95833b0cdbbdcc776fe19 (patch)
tree313c90278a6268c3f1b20eb4e6fe87ef8e086caf /src/cmd/compile/internal/syntax/parser_test.go
parent53fc330e2d154443acf3d01e0d68bae22b2b7804 (diff)
downloadgo-7a26d9fcedd94a1ba0d95833b0cdbbdcc776fe19.tar.gz
go-7a26d9fcedd94a1ba0d95833b0cdbbdcc776fe19.zip
cmd/compile/internal/syntax: don't panic if no error handler is provided
If no error handler is provided, terminate parsing with first error and report that error. Fixes #17697. Change-Id: I9070faf7239bd53725de141507912b92ded3474b Reviewed-on: https://go-review.googlesource.com/32456 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax/parser_test.go')
-rw-r--r--src/cmd/compile/internal/syntax/parser_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/parser_test.go b/src/cmd/compile/internal/syntax/parser_test.go
index 8e6b77d0c6..780f10835c 100644
--- a/src/cmd/compile/internal/syntax/parser_test.go
+++ b/src/cmd/compile/internal/syntax/parser_test.go
@@ -155,3 +155,10 @@ func verifyPrint(filename string, ast1 *File) {
panic("not equal")
}
}
+
+func TestIssue17697(t *testing.T) {
+ _, err := ReadBytes(nil, nil, nil, 0) // return with parser error, don't panic
+ if err == nil {
+ t.Errorf("no error reported")
+ }
+}