]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: changed representation of typeparam bound in types1
authorDan Scales <danscales@google.com>
Thu, 6 May 2021 21:21:47 +0000 (14:21 -0700)
committerDan Scales <danscales@google.com>
Thu, 13 May 2021 22:20:18 +0000 (22:20 +0000)
commitc3fa51c9a2288ae6441f54e3a59d82015f0b7728
tree976620d5929df6727542ea5fb3f6f7cca1324082
parent9daf3cca8245a156b02da7bafef42637f8196f88
cmd/compile: changed representation of typeparam bound in types1

Especially with typesets, we should be able to fully represent a
typeparam bound as just another type (actually an interface type).
Change the representation of a typeparam in types1 to include a bound,
which is just a type. Changed the signature for NewTypeParam() to take a
sym, and not a package, since we always set the sym (name) of the
typeparam when creating it. No need for an extra pkg field in Typeparam.

Also added index field in the types1 representation of typeparam. This
is especially needed to correctly export the typeparam, and re-import it
as a types2 type (which requires the index to be set correctly).

Change-Id: I50200e2489a97898c37d292b2bd025df790b0277
Reviewed-on: https://go-review.googlesource.com/c/go/+/319929
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/noder/types.go
src/cmd/compile/internal/types/type.go
src/cmd/compile/internal/types2/type.go