aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/codes.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-07-18 13:13:46 -0700
committerMatthew Dempsky <mdempsky@google.com>2022-07-19 23:30:58 +0000
commit318027044aa33c109a6f3e6ac12792f129ff2d6a (patch)
tree1dc39dc5e722e458d2b58ecc37d473f801b13e43 /src/cmd/compile/internal/noder/codes.go
parente971b6a9be7e10df28a9e9bbc6e3f6cf46201957 (diff)
downloadgo-318027044aa33c109a6f3e6ac12792f129ff2d6a.tar.xz
[dev.unified] cmd/compile/internal/noder: explicit nil handling
Currently, uses of "nil" are handling as references to cmd/compile's own untyped "nil" object, and then we rely on implicitly converting that to its appropriate type. But there are cases where this can subtly go wrong (e.g., the switch test case added in the previous CL). Instead, explicitly handling "nil" expressions so that we can construct them directly with the appropriate type, as computed already by types2. Change-Id: I587f044f60f24e87525dde6d7dad6c58f14478de Reviewed-on: https://go-review.googlesource.com/c/go/+/418100 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/codes.go')
-rw-r--r--src/cmd/compile/internal/noder/codes.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/codes.go b/src/cmd/compile/internal/noder/codes.go
index f7ad2503c2..1a60ea39bb 100644
--- a/src/cmd/compile/internal/noder/codes.go
+++ b/src/cmd/compile/internal/noder/codes.go
@@ -53,6 +53,7 @@ const (
exprConvert
exprNew
exprMake
+ exprNil
)
type codeAssign int