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: unnecessary 2nd error message for invalid integer literal #30722

Closed
griesemer opened this issue Mar 10, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@griesemer
Copy link
Contributor

commented Mar 10, 2019

go tool compile -e x.go of

package main

const (
	_ = 1_
	_ = 0b
	_ = 0o
	_ = 0x
	_ = 0xde__ad
)

produces:

x.go:4:6: malformed integer constant: 1_
x.go:4:7: '_' must separate successive digits
x.go:5:6: malformed integer constant: 0b
x.go:5:8: binary literal has no digits
x.go:6:6: malformed integer constant: 0o
x.go:6:8: octal literal has no digits
x.go:7:6: malformed integer constant: 0x
x.go:7:8: hexadecimal literal has no digits
x.go:8:6: malformed integer constant: 0xde__ad
x.go:8:11: '_' must separate successive digits

The lexer already produces a detailed error message, no need for the noder to report a 2nd error.

@griesemer griesemer added the NeedsFix label Mar 10, 2019

@griesemer griesemer added this to the Go1.13 milestone Mar 10, 2019

@griesemer griesemer self-assigned this Mar 10, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Mar 10, 2019

Change https://golang.org/cl/166519 mentions this issue: cmd/compile: don't report redundant error for invalid integer literals

@gopherbot gopherbot closed this in bea58ef Mar 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.