cmd/compile: make typecheck set n.Type.Nod when returning OTYPE
typecheck only set n.Type.Nod for declared type, and leave it nil for anonymous types, type alias. It leads to compiler crashes, because n.Type.Nod is nil at the time dowidth was called. Fixing it by set n.Type.Nod right after n.Type initialization if n.Op is OTYPE. When embedding interface cycles involve in type alias, it also helps pointing the error message to the position of the type alias declaration, instead of position of embedding interface. Fixes #31872 Change-Id: Ia18391e987036a91f42ba0c08b5506f52d07f683 Reviewed-on: https://go-review.googlesource.com/c/go/+/191540 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Showing
Please register or sign in to comment