diff options
author | Matthew Dempsky <mdempsky@google.com> | 2019-09-12 10:18:03 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2019-09-16 15:30:51 +0000 |
commit | 606019cb4b1c8fb57e5a83747ee0aff1054291d8 (patch) | |
tree | 04ff2c4bbf57c97d339663d2d46999702983121d /test/inline.go | |
parent | 4ae25ff1405f9d6b25f40141f42196e8f142f207 (diff) | |
download | go-606019cb4b1c8fb57e5a83747ee0aff1054291d8.tar.gz go-606019cb4b1c8fb57e5a83747ee0aff1054291d8.zip |
cmd/compile: trim function name prefix from escape diagnostics
This information is redundant with the position information already
provided. Also, no other -m diagnostics print out function name.
While here, report parameter leak diagnostics against the parameter
declaration position rather than the function, and use Warnl for
"moved to heap" messages.
Test cases updated programmatically by removing the first word from
every "no match for" error emitted by run.go:
go run run.go |& \
sed -E -n 's/^(.*):(.*): no match for `([^ ]* (.*))` in:$/\1!\2!\3!\4/p' | \
while IFS='!' read -r fn line before after; do
before=$(echo "$before" | sed 's/[.[\*^$()+?{|]/\\&/g')
after=$(echo "$after" | sed -E 's/(\&|\\)/\\&/g')
fn=$(find . -name "${fn}" | head -1)
sed -i -E -e "${line}s/\"${before}\"/\"${after}\"/" "${fn}"
done
Passes toolstash-check.
Change-Id: I6e02486b1409e4a8dbb2b9b816d22095835426b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/195040
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/inline.go')
-rw-r--r-- | test/inline.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/inline.go b/test/inline.go index 7e0551708e..8ebffedfb7 100644 --- a/test/inline.go +++ b/test/inline.go @@ -95,15 +95,15 @@ func p() int { } func q(x int) int { - foo := func() int { return x * 2 } // ERROR "can inline q.func1" "q func literal does not escape" + foo := func() int { return x * 2 } // ERROR "can inline q.func1" "func literal does not escape" return foo() // ERROR "inlining call to q.func1" } func r(z int) int { - foo := func(x int) int { // ERROR "can inline r.func1" "r func literal does not escape" + foo := func(x int) int { // ERROR "can inline r.func1" "func literal does not escape" return x + z } - bar := func(x int) int { // ERROR "r func literal does not escape" + bar := func(x int) int { // ERROR "func literal does not escape" return x + func(y int) int { // ERROR "can inline r.func2.1" return 2*y + x*z }(x) // ERROR "inlining call to r.func2.1" @@ -112,7 +112,7 @@ func r(z int) int { } func s0(x int) int { - foo := func() { // ERROR "can inline s0.func1" "s0 func literal does not escape" + foo := func() { // ERROR "can inline s0.func1" "func literal does not escape" x = x + 1 } foo() // ERROR "inlining call to s0.func1" @@ -120,7 +120,7 @@ func s0(x int) int { } func s1(x int) int { - foo := func() int { // ERROR "can inline s1.func1" "s1 func literal does not escape" + foo := func() int { // ERROR "can inline s1.func1" "func literal does not escape" return x } x = x + 1 @@ -145,7 +145,7 @@ func switchBreak(x, y int) int { } // can't currently inline functions with a type switch -func switchType(x interface{}) int { // ERROR "switchType x does not escape" +func switchType(x interface{}) int { // ERROR "x does not escape" switch x.(type) { case int: return x.(int) |