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
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@smasher164
Copy link
Member

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 :=
@smasher164 smasher164 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 21, 2020
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

3 participants