From: Matthew Dempsky Date: Fri, 25 Jun 2021 08:49:26 +0000 (-0700) Subject: [dev.typeparams] cmd/compile: fix TestUnifiedCompare X-Git-Tag: go1.18beta1~1818^2^2~273 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9fe7c38d3d;p=gostls13.git [dev.typeparams] cmd/compile: fix TestUnifiedCompare We need to start the capture walk from expr.Body, not expr, otherwise in quirks mode we'll set all of the captured variables' positions to expr.Body.Rbrace. Change-Id: Ic93f2773ae3756c2ec88dac17b4e9fb5a0771734 Reviewed-on: https://go-review.googlesource.com/c/go/+/330889 Trust: Matthew Dempsky Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Cuong Manh Le --- diff --git a/src/cmd/compile/internal/noder/writer.go b/src/cmd/compile/internal/noder/writer.go index cc44a80a42..8765f85362 100644 --- a/src/cmd/compile/internal/noder/writer.go +++ b/src/cmd/compile/internal/noder/writer.go @@ -1281,7 +1281,7 @@ func (w *writer) captureVars(expr *syntax.FuncLit) (closureVars []posObj, locals localsIdx: make(map[types2.Object]int), } - syntax.Walk(expr, &v) + syntax.Walk(expr.Body, &v) return v.closureVars, v.localsIdx }