cmd/compile: parsing problem
dvyukov opened this issue · 1 comments
dvyukov commented
old/new parser disagree on error message for the following program:
package n
{
$ go tool compile a.go
syntax error: non-declaration statement outside function body
$ go tool compile -oldparser a.go
syntax error: unexpected semicolon or newline before {
go version devel +25a28da Sun Nov 15 23:41:28 2015 +0000 linux/amd64
griesemer commented
I think here the new error message is clearly better: The -oldparser error seems to imply that if there were no semi or newline, the { would be ok, but that's certainly not the case.
Furthermore, when removing the newline as in
package n {
both the old and new compiler agree and report
unexpected {, expecting semicolon or newline