New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go/parser: more robust error handling #11377
Labels
Milestone
Comments
FWIW, the new syntax parser and thus cmd/compile produce exactly one error in this case:
|
Change https://golang.org/cl/87495 mentions this issue: |
Change https://golang.org/cl/87900 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Feb 12, 2018
R=go1.11 This is a follow up for #11377 which reported that an error like /tmp/xx.go:9:6: expected '(', found 'IDENT' F1 shouldn't print 'IDENT', as it's just an internal detail. The relevant change wasn't made in the original fix, so here it is. For #11377. Change-Id: Ib76957d86b88e3e63646fbe4abf03a3b9d045139 Reviewed-on: https://go-review.googlesource.com/87900 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm going to try to start filing bugs against go/parser when I notice things that trigger less than ideal error messages in the course of ordinary usage (via goimports, go test, and so on), because I think there are some simple cases that can be improved. I expect most of the initial ones will be about getting too many errors. Here's the first one.
This produces:
This is a reduced version of a real case I had, where an extra paren in a function near the top of a long source file triggered many many messages. In this program, the braces are still balanced, so there should be a good signal for the parser to recover by the end of the function (and ideally the end of the enclosing block, although here they are the same).
This is a case where the yacc grammar's error recovery is actually doing better:
Also the IDENT in the go/parser error is probably not helpful to the user. It's an internal detail.
The text was updated successfully, but these errors were encountered: