aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/typecheck.go
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-02-19 13:47:14 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-03-04 06:36:07 +0000
commit8c22874e4e804e29ca040599ec63bb9e35233acd (patch)
treee09f8d54135294924fd0cf2fde6a98c239cbdeb6 /src/cmd/compile/internal/typecheck/typecheck.go
parent12a405b96aadc0174d3b63e61f593bcc28465af0 (diff)
downloadgo-8c22874e4e804e29ca040599ec63bb9e35233acd.tar.gz
go-8c22874e4e804e29ca040599ec63bb9e35233acd.zip
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 <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/typecheck.go')
-rw-r--r--src/cmd/compile/internal/typecheck/typecheck.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go
index 278e64fc61..e7d4e81672 100644
--- a/src/cmd/compile/internal/typecheck/typecheck.go
+++ b/src/cmd/compile/internal/typecheck/typecheck.go
@@ -1612,6 +1612,10 @@ func checkassign(stmt ir.Node, n ir.Node) {
return
}
+ defer n.SetType(nil)
+ if n.Diag() {
+ return
+ }
switch {
case n.Op() == ir.ODOT && n.(*ir.SelectorExpr).X.Op() == ir.OINDEXMAP:
base.Errorf("cannot assign to struct field %v in map", n)
@@ -1622,13 +1626,6 @@ func checkassign(stmt ir.Node, n ir.Node) {
default:
base.Errorf("cannot assign to %v", n)
}
- n.SetType(nil)
-}
-
-func checkassignlist(stmt ir.Node, l ir.Nodes) {
- for _, n := range l {
- checkassign(stmt, n)
- }
}
func checkassignto(src *types.Type, dst ir.Node) {