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

types2: provide better error message for short variable declarations #43087

Open
griesemer opened this issue Dec 9, 2020 · 0 comments
Open

types2: provide better error message for short variable declarations #43087

griesemer opened this issue Dec 9, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 9, 2020

Given

var a int
a, b, b := 1, 2, 3
_ = a
_ = b

The compiler reports: b repeated on left side of :=.
types2 (go tool compile -G) reports: b redeclared in this block.

The compiler error message seems better because it's actually ok to "redeclare" a variable (here: a) with a short variable declaration.

cc: @findleyr

@griesemer griesemer added the NeedsFix label Dec 9, 2020
@griesemer griesemer added this to the Go1.17 milestone Dec 9, 2020
@griesemer griesemer self-assigned this Dec 9, 2020
@griesemer griesemer changed the title types2: provide better error message for short variable errors types2: provide better error message for short variable declarations Dec 9, 2020
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.