]> Cypherpunks repositories - gostls13.git/commit
[dev.regabi] cmd/compile: cleanup type-checking of defined types
authorMatthew Dempsky <mdempsky@google.com>
Tue, 1 Dec 2020 09:01:59 +0000 (01:01 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 1 Dec 2020 17:15:12 +0000 (17:15 +0000)
commitf2311462ab6f2359006f42b7febd19ce95a9bbcf
treeb59da4b770bf52488f7fb0869f749e6c7ebb0496
parent2d6ff998edc0f3877ee24d28647a494491742f25
[dev.regabi] cmd/compile: cleanup type-checking of defined types

The code for type-checking defined types was scattered between
typecheckdef, typecheckdeftype, and setUnderlying. There was redundant
work between them, and setUnderlying also needed to redo a lot of work
because of its brute-force solution of just copying all Type fields.

This CL reorders things so as many of the defined type's fields are
set in advance (in typecheckdeftype), and then setUnderlying only
copies over the details actually needed from the underlying type.

Incidentally, this evidently improves our error handling for an
existing test case, by allowing us to report an additional error.

Passes toolstash/buildall.

Change-Id: Id59a24341e7e960edd1f7366c3e2356da91b9fe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/274432
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/gc/typecheck.go
test/fixedbugs/issue28079b.go