1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:50:03 -07:00

go/types, types2: be deliberate with Checker.use in Checker.assignVar

Follow-up on comment in CL 486135. Cleanup.

Change-Id: Ib0480d52e30687350f8328965c18fa83262df0a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/486215
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Robert Griesemer 2023-04-18 19:20:28 -07:00 committed by Gopher Robot
parent 969ab34e46
commit 522eace4ca
2 changed files with 4 additions and 2 deletions

View File

@ -235,9 +235,10 @@ func (check *Checker) lhsVar(lhs syntax.Expr) Type {
func (check *Checker) assignVar(lhs, rhs syntax.Expr, x *operand) {
T := check.lhsVar(lhs) // nil if lhs is _
if T == Typ[Invalid] {
check.use(rhs)
if x != nil {
x.mode = invalid
} else {
check.use(rhs)
}
return
}

View File

@ -234,9 +234,10 @@ func (check *Checker) lhsVar(lhs ast.Expr) Type {
func (check *Checker) assignVar(lhs, rhs ast.Expr, x *operand) {
T := check.lhsVar(lhs) // nil if lhs is _
if T == Typ[Invalid] {
check.use(rhs)
if x != nil {
x.mode = invalid
} else {
check.use(rhs)
}
return
}