]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: don't print aliased type (in comments) for Alias types
authorRobert Griesemer <gri@golang.org>
Thu, 7 Dec 2023 00:36:10 +0000 (16:36 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 7 Dec 2023 01:05:50 +0000 (01:05 +0000)
Fixes #64584.

Change-Id: I756d6026d10f130c1dd5026891b7cc3c640d7f78
Reviewed-on: https://go-review.googlesource.com/c/go/+/548135
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

src/cmd/compile/internal/types2/issues_test.go
src/cmd/compile/internal/types2/typestring.go
src/go/types/issues_test.go
src/go/types/typestring.go

index 95b9f940784da4481680009b31c24c45e42ae7e2..a8b70b89642f18a1be482983fa6679727d632971 100644 (file)
@@ -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)
        }
index 0e0da0f7f69f1d3c3a0344043577a3e711e06994..4b410af6b75a776ed1372e8b3387f1ee24096e54 100644 (file)
@@ -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:
index c38459e488a6f1628ed3461ce9f35335ea946681..91631fe9c77e6d48f004c95c674776e8d6e86e82 100644 (file)
@@ -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)
        }
index d5623d3d86a0d984aea02797f1f155645267af2a..23bddb2673d416046d51f4a10c210c3eb7b2f426 100644 (file)
@@ -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: