You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to receive a syntax error like "unexpected semicolon or newline". Instead, no error and an ast containing a Decl with Type nil is emited.
Go version in playground at time of report: go1.3.2
My local go version at time of report: go version devel +1757b5c Thu Dec 11 07:31:32 2014 +0000 linux/amd64
The text was updated successfully, but these errors were encountered:
The go/parser deliberately accepts a larger language than what the spec permits, for more lenient parsing which permits better error messages later. If you run through go/types, you will get the error:
$ gotype z.go
z.go:5:9: missing type or init expr
z.go:5:9: x declared but not used
Perhaps in this case the parser could be tightened a bit.
It's trivial to add a verification pass if this is required. This is issue is not urgent.
The following code
var x;
is invalid and rejected by gc (http://play.golang.org/p/gIxpWYiElI).
However, go/parser parses it without returning an error. Code: http://play.golang.org/p/F2J2uFWvDu.
I expected to receive a syntax error like "unexpected semicolon or newline". Instead, no error and an ast containing a Decl with Type nil is emited.
Go version in playground at time of report: go1.3.2
My local go version at time of report: go version devel +1757b5c Thu Dec 11 07:31:32 2014 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: