Skip to content

Commit 8c22874

Browse files
committed
cmd/compile: skip diag error in checkassign if one was emitted
While at it, also remove checkassignlist, which is not used. For #43311 Change-Id: Ie7ed81f68080d8881fca6035da64a9755f2cb555 Reviewed-on: https://go-review.googlesource.com/c/go/+/294032 Trust: Cuong Manh Le <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
1 parent 12a405b commit 8c22874

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/cmd/compile/internal/typecheck/typecheck.go

+4-7
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,10 @@ func checkassign(stmt ir.Node, n ir.Node) {
16121612
return
16131613
}
16141614

1615+
defer n.SetType(nil)
1616+
if n.Diag() {
1617+
return
1618+
}
16151619
switch {
16161620
case n.Op() == ir.ODOT && n.(*ir.SelectorExpr).X.Op() == ir.OINDEXMAP:
16171621
base.Errorf("cannot assign to struct field %v in map", n)
@@ -1622,13 +1626,6 @@ func checkassign(stmt ir.Node, n ir.Node) {
16221626
default:
16231627
base.Errorf("cannot assign to %v", n)
16241628
}
1625-
n.SetType(nil)
1626-
}
1627-
1628-
func checkassignlist(stmt ir.Node, l ir.Nodes) {
1629-
for _, n := range l {
1630-
checkassign(stmt, n)
1631-
}
16321629
}
16331630

16341631
func checkassignto(src *types.Type, dst ir.Node) {

0 commit comments

Comments
 (0)