Skip to content

Commit 5e724cc

Browse files
griesemergopherbot
authored andcommitted
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 <[email protected]> Run-TryBot: Robert Griesemer <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]>
1 parent 2b44257 commit 5e724cc

File tree

4 files changed

+2
-6
lines changed

4 files changed

+2
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ type S struct{ A }
998998
}
999999

10001000
got := S.String()
1001-
const want = "type p.S struct{p.A /* = []int */}"
1001+
const want = "type p.S struct{p.A}"
10021002
if got != want {
10031003
t.Fatalf("got %q; want %q", got, want)
10041004
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ func (w *typeWriter) typ(typ Type) {
331331
if w.ctxt != nil {
332332
// TODO(gri) do we need to print the alias type name, too?
333333
w.typ(Unalias(t.obj.typ))
334-
} else {
335-
w.string(fmt.Sprintf(" /* = %s */", Unalias(t.obj.typ)))
336334
}
337335

338336
default:

src/go/types/issues_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ type S struct{ A }
10081008
}
10091009

10101010
got := S.String()
1011-
const want = "type p.S struct{p.A /* = []int */}"
1011+
const want = "type p.S struct{p.A}"
10121012
if got != want {
10131013
t.Fatalf("got %q; want %q", got, want)
10141014
}

src/go/types/typestring.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ func (w *typeWriter) typ(typ Type) {
334334
if w.ctxt != nil {
335335
// TODO(gri) do we need to print the alias type name, too?
336336
w.typ(Unalias(t.obj.typ))
337-
} else {
338-
w.string(fmt.Sprintf(" /* = %s */", Unalias(t.obj.typ)))
339337
}
340338

341339
default:

0 commit comments

Comments
 (0)