Skip to content
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

cmd/compile: parsing problem #13270

Closed
dvyukov opened this issue Nov 16, 2015 · 1 comment
Closed

cmd/compile: parsing problem #13270

dvyukov opened this issue Nov 16, 2015 · 1 comment
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Nov 16, 2015

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

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Nov 16, 2015
@griesemer
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Nov 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants