ebd34e3e45
In this test, traditionally the comparison `*l == r[0]` was left as a comparison between `*l` (type `any`) and `r[0]` (type `*int`), and the rest of the compiler needed to handle mixed-typed comparisons. However, this means more complexity for wiring up explicit rtypes. To simplify rtype handling, the next CL will change unified IR to instead handle the expression as `*l == any(r[0])`. However, a consequence of this currently is that walk will now sequence the `any(r[0])` expression first, because it involves a concrete-to-interface conversion. And in turn, this means the `r[0]` panic ("index out of bounds") will take priority over the `*l` panic ("nil pointer dereference"). This is a change in user-visible semantics in some cases, but the Go spec leaves this unspecified, so it shouldn't be an issue. Note also: gccgo has the same behavior (i.e., panicking on index out of bounds, not nil pointer dereference), and cmd/compile also already has the same behavior when the interface conversion is explicit (as in the added "nil pointer dereference #3" test case). Updates #23735. Updates #32187. Change-Id: I49e5dcca85b4680f9c8780ef0013e64254d38fe5 Reviewed-on: https://go-review.googlesource.com/c/go/+/418097 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: David Chase <drchase@google.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.