]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: simplify OPTRLIT handling
authorMatthew Dempsky <mdempsky@google.com>
Wed, 25 Sep 2019 07:21:23 +0000 (00:21 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 26 Sep 2019 18:45:53 +0000 (18:45 +0000)
commit00b773a4a94b16544a6d1b812e42c068a64efad6
tree0c50fd0004013bd952825d6a4d43437b9ab95004
parent87e2b34f7bdd997b09f926ccbef6bfd2794d8e2a
cmd/compile: simplify OPTRLIT handling

Previously, we would recognize &(T{...}) expressions during type
checking, rewrite them into (*T){...}, and then do a lot of extra work
to make sure the user doesn't write (*T){...} themselves and
resynthesizing the OPTRLIT later on.

This CL simply handles &T{...} directly in the straight forward
manner, by changing OADDR directly to OPTRLIT when appropriate.

While here, match go/types's invalid composite literal type error
message.

Passes toolstash-check.

Change-Id: I902b14c7e2cd9fa93e6915dd58272d2352ba38f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/197120
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/fmt.go
src/cmd/compile/internal/gc/iexport.go
src/cmd/compile/internal/gc/iimport.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/typecheck.go
test/complit1.go