mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
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 <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
c9912780ab
commit
e17439e087
1 changed files with 0 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue