From 00b773a4a94b16544a6d1b812e42c068a64efad6 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 25 Sep 2019 00:21:23 -0700 Subject: 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 TryBot-Result: Gobot Gobot Reviewed-by: Robert Griesemer --- test/complit1.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/complit1.go') 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 -- cgit v1.2.1