]> Cypherpunks repositories - gostls13.git/commit
go/types: ObjectString: remove only 1 Alias for "type A = RHS"
authorAlan Donovan <adonovan@google.com>
Wed, 27 Mar 2024 13:40:24 +0000 (09:40 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 3 Apr 2024 18:49:21 +0000 (18:49 +0000)
commit61a3ee54411086d4bf996b65dd3bc2b7432f9b51
tree2366df59e303f62805e38e75b0d85f6f665a0b4b
parent6ffbcd82497afd00c3b345e45cc3969b5f07c225
go/types: ObjectString: remove only 1 Alias for "type A = RHS"

As we migrate towards materialized Alias types, the ObjectString
for a type A such as
   type A = B
   type B = int
should be "type A = B", removing exactly one Alias constructor
from the type of A. (The previous behavior was "type A = int".)

I suspect the existing Alias.{Unalias,Underlying} API is
inadequate and that we will need an Alias.RHS accessor that
removes exactly one Alias. Other clients such as the import/
export packages will need it, because aliases are not
isomorphic to defined types, in which, given
   type A B
   type B int
the Underlying of A is indeed int. See #66559.

Change-Id: I11a4aacbe6dbeeafc3aee31b3c096296b5970cd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/574716
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/object.go
src/cmd/compile/internal/types2/object_test.go
src/go/types/object.go
src/go/types/object_test.go