diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-06-25 10:04:51 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-06-25 23:10:17 +0000 |
commit | 942edc750292060450fda38835c452f6125447c3 (patch) | |
tree | cda8f0643ba64df9760023d818a4e85636fb3b92 /src/cmd/compile/internal/walk | |
parent | 373ca3a846d64733b0391dcdcc55631904a3c41c (diff) | |
download | go-942edc750292060450fda38835c452f6125447c3.tar.gz go-942edc750292060450fda38835c452f6125447c3.zip |
[dev.typeparams] cmd/compile: rename types.Type.{Short,Long}String to {Link,Name}String
The original names "ShortString" and "LongString" refer back to the
fmt verbs used to request their formatting styles. However, I always
get confused working with them, in particular because (1) the
"ShortString" description, which uses package-path qualification, is
actually generally longer than the "LongString" description, which
uses package-name qualification; and (2) the documentation mentions
how they're often used, but doesn't actually describe why they're safe
for those purposes.
This CL renames them to "LinkString" and "NameString", respectively,
based on their primary use cases. It also attempts to more completely
describe the strings they return and how they can be used correctly.
Change-Id: I9158ae3eafa8ac53da31a78c7a6d929dc0199afe
Reviewed-on: https://go-review.googlesource.com/c/go/+/330910
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/walk')
-rw-r--r-- | src/cmd/compile/internal/walk/order.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/walk/order.go b/src/cmd/compile/internal/walk/order.go index 62d9b95be9..59701613c3 100644 --- a/src/cmd/compile/internal/walk/order.go +++ b/src/cmd/compile/internal/walk/order.go @@ -78,7 +78,7 @@ func (o *orderState) newTemp(t *types.Type, clear bool) *ir.Name { var v *ir.Name // Note: LongString is close to the type equality we want, // but not exactly. We still need to double-check with types.Identical. - key := t.LongString() + key := t.NameString() a := o.free[key] for i, n := range a { if types.Identical(t, n.Type()) { @@ -370,7 +370,7 @@ func (o *orderState) markTemp() ordermarker { // which must have been returned by markTemp. func (o *orderState) popTemp(mark ordermarker) { for _, n := range o.temp[mark:] { - key := n.Type().LongString() + key := n.Type().NameString() o.free[key] = append(o.free[key], n) } o.temp = o.temp[:mark] |