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: better error for missed comma #8401

Closed
dvyukov opened this issue Jul 21, 2014 · 5 comments
Closed

cmd/compile: better error for missed comma #8401

dvyukov opened this issue Jul 21, 2014 · 5 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 21, 2014

http://play.golang.org/p/5iVYdAPl8B

gc says:
prog.go:12: syntax error: unexpected name, expecting }

gofmt says:
12:18: expected '}', found 'IDENT' Const2 (and 1 more errors)

While what is missed is actually a comma. It's unclear why compiler does not expect a
comma there. It would be nice if the error message would mention comma.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-none.

@griesemer
Copy link
Contributor

Comment 2:

Since there is no comma, it expects a '}'. But fair enough, it could say expected ',' or
'}'.
Created separate issue #8940 for go/parser.

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: better error for missed comma cmd/compile: better error for missed comma Jun 8, 2015
@odeke-em
Copy link
Member

I believe this issue was fixed by https://go-review.googlesource.com/#/c/17080 and works as intended explaining the missing comma

Please try clicking "Run" or "Format" on the original test program https://play.golang.org/p/5iVYdAPl8B or see the screenshots below
screen shot 2016-07-24 at 1 54 05 am

screen shot 2016-07-24 at 1 53 56 am

@odeke-em
Copy link
Member

Ping @bradfitz.

@bradfitz
Copy link
Contributor

Thanks. Closing.

@golang golang locked and limited conversation to collaborators Jul 27, 2017
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

7 participants