Commit b136267b authored by LE Manh Cuong's avatar LE Manh Cuong Committed by Matthew Dempsky

cmd/compile: do not set n.Type.Sym in typecheckdeftype

typecheckdef calls typecheckdeftype, which will also set n.Type.Sym,
causing duplicated work. So do not set n.Type.Sym in typecheckdeftype to
prevent this, and also keep populating n.Type info in one place make
more sense.

Change-Id: I62671babd750f9d5d0bbfcf8d7eecd2cc314c955
Reviewed-on: https://go-review.googlesource.com/c/go/+/179579
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 2393d161
......@@ -3496,7 +3496,6 @@ func typecheckdeftype(n *Node) {
defer tracePrint("typecheckdeftype", n)(nil)
}
n.Type.Sym = n.Sym
n.SetTypecheck(1)
n.Name.Param.Ntype = typecheck(n.Name.Param.Ntype, Etype)
t := n.Name.Param.Ntype.Type
......@@ -3673,7 +3672,7 @@ func typecheckdef(n *Node) {
}
n.SetWalkdef(1)
setTypeNode(n, types.New(TFORW))
n.Type.Sym = n.Sym // TODO(gri) this also happens in typecheckdeftype(n) - where should it happen?
n.Type.Sym = n.Sym
nerrors0 := nerrors
typecheckdeftype(n)
if n.Type.Etype == TFORW && nerrors > nerrors0 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment