]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.unified] cmd/compile/internal/noder: explicit nil handling
authorMatthew Dempsky <mdempsky@google.com>
Mon, 18 Jul 2022 20:13:46 +0000 (13:13 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 19 Jul 2022 23:30:58 +0000 (23:30 +0000)
commit318027044aa33c109a6f3e6ac12792f129ff2d6a
tree1dc39dc5e722e458d2b58ecc37d473f801b13e43
parente971b6a9be7e10df28a9e9bbc6e3f6cf46201957
[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>
src/cmd/compile/internal/noder/codes.go
src/cmd/compile/internal/noder/reader.go
src/cmd/compile/internal/noder/writer.go