From: Robert Griesemer Date: Fri, 20 Aug 2021 04:35:57 +0000 (-0700) Subject: go/types: don't override x.mode before using it X-Git-Tag: go1.18beta1~1687 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e17439e0877d6ddb6881d9eb59758c27cc62f930;p=gostls13.git go/types: don't override x.mode before using it Changing the mode of x before using the old value is clearly wrong. And x is not needed anymore afterward so besides being misplaced, the assignment is not needed in the first place. Tested manually as it's a bit complicated to set up a test. Needs to be back-ported to 1.17. Fixes #47777. Change-Id: I06f1fa9443eb98009b4276f566d557fd52f1d6d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/343809 Trust: Robert Griesemer Reviewed-by: Matthew Dempsky --- diff --git a/src/go/types/call.go b/src/go/types/call.go index 390e9cd892..08ef2451bf 100644 --- a/src/go/types/call.go +++ b/src/go/types/call.go @@ -223,7 +223,6 @@ func (check *Checker) exprList(elist []ast.Expr, allowCommaOk bool) (xlist []*op // exactly one (possibly invalid or comma-ok) value xlist = []*operand{&x} if allowCommaOk && (x.mode == mapindex || x.mode == commaok || x.mode == commaerr) { - x.mode = value x2 := &operand{mode: value, expr: e, typ: Typ[UntypedBool]} if x.mode == commaerr { x2.typ = universeError