From: LE Manh Cuong Date: Thu, 30 May 2019 16:01:37 +0000 (+0700) Subject: cmd/compile: do not set n.Type.Sym in typecheckdeftype X-Git-Tag: go1.14beta1~1273 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b136267b87a5004f38665af2bc4237a53c776f0e;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Matthew Dempsky Reviewed-by: Robert Griesemer --- diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 20d2af59e9..5e5d692824 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -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 {