From: Robert Griesemer Date: Thu, 7 Dec 2023 00:36:10 +0000 (-0800) Subject: go/types, types2: don't print aliased type (in comments) for Alias types X-Git-Tag: go1.22rc1~72 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5e724ccb2b092a6bc294b63c4e33ed1da317ca87;p=gostls13.git go/types, types2: don't print aliased type (in comments) for Alias types Fixes #64584. Change-Id: I756d6026d10f130c1dd5026891b7cc3c640d7f78 Reviewed-on: https://go-review.googlesource.com/c/go/+/548135 Reviewed-by: Alan Donovan Run-TryBot: Robert Griesemer TryBot-Result: Gopher Robot Reviewed-by: Robert Griesemer Auto-Submit: Robert Griesemer --- diff --git a/src/cmd/compile/internal/types2/issues_test.go b/src/cmd/compile/internal/types2/issues_test.go index 95b9f94078..a8b70b8964 100644 --- a/src/cmd/compile/internal/types2/issues_test.go +++ b/src/cmd/compile/internal/types2/issues_test.go @@ -998,7 +998,7 @@ type S struct{ A } } got := S.String() - const want = "type p.S struct{p.A /* = []int */}" + const want = "type p.S struct{p.A}" if got != want { t.Fatalf("got %q; want %q", got, want) } diff --git a/src/cmd/compile/internal/types2/typestring.go b/src/cmd/compile/internal/types2/typestring.go index 0e0da0f7f6..4b410af6b7 100644 --- a/src/cmd/compile/internal/types2/typestring.go +++ b/src/cmd/compile/internal/types2/typestring.go @@ -331,8 +331,6 @@ func (w *typeWriter) typ(typ Type) { if w.ctxt != nil { // TODO(gri) do we need to print the alias type name, too? w.typ(Unalias(t.obj.typ)) - } else { - w.string(fmt.Sprintf(" /* = %s */", Unalias(t.obj.typ))) } default: diff --git a/src/go/types/issues_test.go b/src/go/types/issues_test.go index c38459e488..91631fe9c7 100644 --- a/src/go/types/issues_test.go +++ b/src/go/types/issues_test.go @@ -1008,7 +1008,7 @@ type S struct{ A } } got := S.String() - const want = "type p.S struct{p.A /* = []int */}" + const want = "type p.S struct{p.A}" if got != want { t.Fatalf("got %q; want %q", got, want) } diff --git a/src/go/types/typestring.go b/src/go/types/typestring.go index d5623d3d86..23bddb2673 100644 --- a/src/go/types/typestring.go +++ b/src/go/types/typestring.go @@ -334,8 +334,6 @@ func (w *typeWriter) typ(typ Type) { if w.ctxt != nil { // TODO(gri) do we need to print the alias type name, too? w.typ(Unalias(t.obj.typ)) - } else { - w.string(fmt.Sprintf(" /* = %s */", Unalias(t.obj.typ))) } default: