mirror of
https://github.com/golang/go.git
synced 2025-05-22 16:09:37 +00:00
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: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
2393d16147
commit
b136267b87
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user