From 4dfc7333f4ebe67e0aa7f429ce73c9d58a2fc309 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 10 Dec 2020 20:55:10 -0500 Subject: [dev.regabi] cmd/compile: update ir/fmt for concrete types An automated rewrite will add concrete type assertions after a test of n.Op(), when n can be safely type-asserted (meaning, n is not reassigned a different type, n is not reassigned and then used outside the scope of the type assertion, and so on). This sequence of CLs handles the code that the automated rewrite does not: adding specific types to function arguments, adjusting code not to call n.Left() etc when n may have multiple representations, and so on. This CL handles package fmt. There are various type assertions but also some rewriting to lean more heavily on reflection. Passes buildall w/ toolstash -cmp. Change-Id: I503467468b42ace11bff2ba014b03cfa345e6d03 Reviewed-on: https://go-review.googlesource.com/c/go/+/277915 Trust: Russ Cox Reviewed-by: Matthew Dempsky --- test/escape_param.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/escape_param.go') diff --git a/test/escape_param.go b/test/escape_param.go index 993e914e1d..dc93f689cf 100644 --- a/test/escape_param.go +++ b/test/escape_param.go @@ -212,7 +212,7 @@ func caller7() { // **in -> heap func param8(i **int) { // ERROR "i does not escape$" - sink = **i // ERROR "\* \(\*i\) escapes to heap" + sink = **i // ERROR "\*\(\*i\) escapes to heap" } func caller8() { @@ -402,7 +402,7 @@ func caller13h() { var p *int v := &Val{&p} // ERROR "&Val{...} does not escape$" v.param13(&i) - sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" + sink = **v.p // ERROR "\*\(\*v\.p\) escapes to heap" } type Node struct { -- cgit v1.2.1