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: inconsistent error message when identifier begins with invalid character #42114

Open
smasher164 opened this issue Oct 21, 2020 · 0 comments

Comments

@smasher164
Copy link
Member

@smasher164 smasher164 commented Oct 21, 2020

What version of Go are you using (go version)?

go version go1.15.2 darwin/amd64

What did you do?

I tried to compile the following program: https://play.golang.org/p/379msfdOuwi

package main

func main() {
	var 3x = 3
	3x := 3  
	var $x = 3
	$x := 3
}

What did you expect to see?

./prog.go:4:6: syntax error: unexpected literal 3, expecting name
./prog.go:5:3: syntax error: unexpected literal 3, expecting name
./prog.go:6:6: invalid character U+0024 '$'
./prog.go:7:2: invalid character U+0024 '$'

What did you see instead?

./prog.go:4:6: syntax error: unexpected literal 3, expecting name
./prog.go:5:3: syntax error: unexpected x at end of statement
./prog.go:6:6: invalid character U+0024 '$'
./prog.go:7:2: invalid character U+0024 '$'
./prog.go:7:5: no new variables on left side of :=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.