Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: inconsistent behaviour in multiple assignment #23017
What version of Go are you using (
[edited: The conclusion below is wrong, see next comment]
@randall77 I think this example in the spec is wrong. The prose before says:
That is, we shouldn't get to the assignment if there's a nil-pointer exception. I'd conclude the behavior for program 1 is correct.
Secondly, I don't see anything in the spec stating when panics due to assignments to nil maps should happen in multiple assignments; I'd conclude that the behavior for program 2 is at least not incorrect.
We should a) fix the spec example, and b) decide if we want to say anything more about map assignments.
My understanding of the spec is that
That is, program 1 should print 1.
Right, the spec says:
So I take that to mean that in the first phase, we evaluate the right hand side, plus any arguments of
See #22881 also.
Passes toolstash-check. Updates #23017 Change-Id: I0ae82e28a6e9e732ba2a6aa98f9b35551efcea10 Reviewed-on: https://go-review.googlesource.com/c/go/+/200580 Run-TryBot: Cuong Manh Le <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Matthew Dempsky <firstname.lastname@example.org>