-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: regressed error message for assignment used as value in if statement #18915
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
Labels
Milestone
Comments
CL https://golang.org/cl/36470 mentions this issue. |
CL https://golang.org/cl/36422 mentions this issue. |
CL https://golang.org/cl/36479 mentions this issue. |
gopherbot
pushed a commit
that referenced
this issue
Feb 7, 2017
…tatement This is a follow-up on https://go-review.googlesource.com/36470 and leads to a more stable fix. The above CL relied on filtering of multiple errors on the same line to avoid more than one error for an `if` statement of the form `if a := 10 {}`. This CL avoids the secondary error ("missing condition in if statement") in the first place. For #18915. Change-Id: I8517f485cc2305965276c17d8f8797d61ef9e999 Reviewed-on: https://go-review.googlesource.com/36479 TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
CL https://golang.org/cl/36480 mentions this issue. |
CL https://golang.org/cl/36424 mentions this issue. |
gopherbot
pushed a commit
that referenced
this issue
Feb 7, 2017
…or "1.7 compliant" For code such as if a := 10 { ... the 1.7 compiler reported a := 10 used as value while the 1.8 compiler reported invalid condition, tag, or type switch guard Changed the error message to match the 1.7 compiler. Fixes #18915. Change-Id: I01308862e461922e717f9f8295a9db53d5a914eb Reviewed-on: https://go-review.googlesource.com/36470 Run-TryBot: Robert Griesemer <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-on: https://go-review.googlesource.com/36422 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
gopherbot
pushed a commit
that referenced
this issue
Feb 7, 2017
…rror for incorrect if statement This is a follow-up on https://go-review.googlesource.com/36470 and leads to a more stable fix. The above CL relied on filtering of multiple errors on the same line to avoid more than one error for an `if` statement of the form `if a := 10 {}`. This CL avoids the secondary error ("missing condition in if statement") in the first place. For #18915. Change-Id: I8517f485cc2305965276c17d8f8797d61ef9e999 Reviewed-on: https://go-review.googlesource.com/36479 TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Reviewed-on: https://go-review.googlesource.com/36424 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +57546d6 Thu Feb 2 22:39:32 2017 +0000 darwin/amd64
Also reproducible on go1.8rc2, go1.8rc3 as well
What operating system and processor architecture are you using (
go env
)?Irrelevant
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I was hacking on a fix for #18747 and was just writing a test/fixedbugs/* test and noticed it.
Repro: https://play.golang.org/p/YnUHrPQPZW or below:
What did you expect to see?
as it does for Go1.7
What did you see instead?
Pre Go1.8:
syntax error: missing condition in if statement
.IMO we should try to fix this bug for Go1.8, otherwise we are going to receive many bug reports
about folks complaining since the
if {{assignment}}; {{comparison}} {
style is code thatI see often, so it would be nice to have clear error messages related to it.
/cc the compiler squad @josharian @mdempsky @griesemer @randall77
The text was updated successfully, but these errors were encountered: