From 9fe7c38d3d7cd8a90e33515981dd00e1233563c9 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Fri, 25 Jun 2021 01:49:26 -0700 Subject: [PATCH] [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 --- src/cmd/compile/internal/noder/writer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/noder/writer.go b/src/cmd/compile/internal/noder/writer.go index cc44a80a42e..8765f853623 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 }