From fbaf71f36bda00fc9eba71720a3c903d15988046 Mon Sep 17 00:00:00 2001 From: thepudds Date: Thu, 31 Aug 2023 10:16:01 -0400 Subject: [PATCH] cmd/compile/internal/dwarfgen: make scope test less sensitive to changes in escape analysis The test function fi is used in TestEscape, and the intent of fi seems to be to leak its argument, but fi is currently sensitive to changes in escape analysis regarding interface receivers. Make fi less sensitive by directly leaking its argument. Change-Id: I16cc3d3a6bd7b08a08c8fc292b0b99c9a54d68d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/524943 Run-TryBot: t hepudds TryBot-Result: Gopher Robot Reviewed-by: Matthew Dempsky Auto-Submit: Matthew Dempsky Reviewed-by: Cherry Mui --- src/cmd/compile/internal/dwarfgen/scope_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/dwarfgen/scope_test.go b/src/cmd/compile/internal/dwarfgen/scope_test.go index ae4a87c52a..ee4170ef44 100644 --- a/src/cmd/compile/internal/dwarfgen/scope_test.go +++ b/src/cmd/compile/internal/dwarfgen/scope_test.go @@ -50,13 +50,14 @@ type testline struct { var testfile = []testline{ {line: "package main"}, + {line: "var sink any"}, {line: "func f1(x int) { }"}, {line: "func f2(x int) { }"}, {line: "func f3(x int) { }"}, {line: "func f4(x int) { }"}, {line: "func f5(x int) { }"}, {line: "func f6(x int) { }"}, - {line: "func fi(x interface{}) { if a, ok := x.(error); ok { a.Error() } }"}, + {line: "func leak(x interface{}) { sink = x }"}, {line: "func gret1() int { return 2 }"}, {line: "func gretbool() bool { return true }"}, {line: "func gret3() (int, int, int) { return 0, 1, 2 }"}, @@ -177,7 +178,7 @@ var testfile = []testline{ {line: " b := 2", scopes: []int{1}, vars: []string{"var &b *int", "var p *int"}}, {line: " p := &b", scopes: []int{1}}, {line: " f1(a)", scopes: []int{1}}, - {line: " fi(p)", scopes: []int{1}}, + {line: " leak(p)", scopes: []int{1}}, {line: " }"}, {line: "}"}, {line: "var fglob func() int"}, -- 2.50.0