summaryrefslogtreecommitdiff
path: root/test/complit1.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2019-09-25 00:21:23 -0700
committerMatthew Dempsky <mdempsky@google.com>2019-09-26 18:45:53 +0000
commit00b773a4a94b16544a6d1b812e42c068a64efad6 (patch)
tree0c50fd0004013bd952825d6a4d43437b9ab95004 /test/complit1.go
parent87e2b34f7bdd997b09f926ccbef6bfd2794d8e2a (diff)
downloadgo-git-00b773a4a94b16544a6d1b812e42c068a64efad6.tar.gz
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>
Diffstat (limited to 'test/complit1.go')
-rw-r--r--test/complit1.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/complit1.go b/test/complit1.go
index 83695a9e88..eb0f920fcb 100644
--- a/test/complit1.go
+++ b/test/complit1.go
@@ -46,8 +46,8 @@ var (
_ = &T{0, 0, "", nil} // ok
_ = &T{i: 0, f: 0, s: "", next: {}} // ERROR "missing type in composite literal|omit types within composite literal"
_ = &T{0, 0, "", {}} // ERROR "missing type in composite literal|omit types within composite literal"
- _ = TP{i: 0, f: 0, s: "", next: {}} // ERROR "invalid pointer type"
- _ = &Ti{} // ERROR "invalid pointer type"
+ _ = TP{i: 0, f: 0, s: "", next: {}} // ERROR "invalid composite literal type TP"
+ _ = &Ti{} // ERROR "invalid composite literal type Ti"
)
type M map[T]T