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
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. 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
Copy link

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

@golang golang locked and limited conversation to collaborators Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants