aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/export_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-01-09 14:58:18 -0800
committerKeith Randall <khr@golang.org>2020-01-13 18:52:18 +0000
commit5d8a61a43eea306b4426adf8b903135517b019c9 (patch)
treef5e2c8e01c67334125cadcf8a17763e09658b38a /src/cmd/compile/internal/ssa/export_test.go
parent52c4488471ed52085a29e173226b3cbd2bf22b20 (diff)
downloadgo-5d8a61a43eea306b4426adf8b903135517b019c9.tar.gz
go-5d8a61a43eea306b4426adf8b903135517b019c9.zip
cmd/compile: print recursive types correctly
Change the type printer to take a map of types that we're currently printing. When we happen upon a type that we're already in the middle of printing, print a reference to it instead. A reference to another type is built using the offset of the first byte of that type's string representation in the result. To facilitate that computation (and it's probably more efficient, regardless), we print the type to a buffer as we go, and build the string at the end. It would be nice to use string.Builder instead of bytes.Buffer, but string.Builder wasn't around in Go 1.4, and we'd like to bootstrap from that version. Fixes #29312 Change-Id: I49d788c1fa20f770df7b2bae3b9979d990d54803 Reviewed-on: https://go-review.googlesource.com/c/go/+/214239 Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/export_test.go')
-rw-r--r--src/cmd/compile/internal/ssa/export_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go
index b76410d597..32f0bcf290 100644
--- a/src/cmd/compile/internal/ssa/export_test.go
+++ b/src/cmd/compile/internal/ssa/export_test.go
@@ -153,7 +153,7 @@ func init() {
// TODO(josharian): move universe initialization to the types package,
// so this test setup can share it.
- types.Tconv = func(t *types.Type, flag, mode, depth int) string {
+ types.Tconv = func(t *types.Type, flag, mode int) string {
return t.Etype.String()
}
types.Sconv = func(s *types.Sym, flag, mode int) string {