]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: make typecheck set n.Type.Nod when returning OTYPE
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Sun, 25 Aug 2019 16:29:32 +0000 (23:29 +0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 29 Aug 2019 16:43:07 +0000 (16:43 +0000)
commite87fe0f1f521150641c8c64db6b919555c255c65
tree7de282be2e6184915d6528100f95ecad70a5c14b
parent647dc1afc5932b0dbbc409727cc81def8e90a0c4
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>
src/cmd/compile/internal/gc/align.go
src/cmd/compile/internal/gc/typecheck.go
test/fixedbugs/issue23823.go