1
0
mirror of https://github.com/golang/go synced 2024-11-17 11:24:51 -07:00

[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 <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Matthew Dempsky 2021-06-25 01:49:26 -07:00
parent f4198f85d5
commit 9fe7c38d3d

View File

@ -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
}