return t.FieldType(0).String() + "," + t.FieldType(1).String()
}
- if depth > 100 {
+ // Avoid endless recursion by setting an upper limit. This also
+ // limits the depths of valid composite types, but they are likely
+ // artificially created.
+ // TODO(gri) should have proper cycle detection here, eventually (issue #29312)
+ if depth > 250 {
return "<...>"
}
default:
Fatalf("cannot export %v (%d) node\n"+
- "==> please file an issue and assign to gri@\n", n.Op, int(n.Op))
+ "\t==> please file an issue and assign to gri@", n.Op, int(n.Op))
}
}
default:
Fatalf("cannot import %v (%d) node\n"+
- "==> please file an issue and assign to gri@\n", op, int(op))
+ "\t==> please file an issue and assign to gri@", op, int(op))
panic("unreachable") // satisfy compiler
}
}
--- /dev/null
+// run
+
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Verify that we emit a valid type descriptor for
+// a fairly deeply nested type.
+
+package main
+
+import "fmt"
+import "strings"
+
+func main() {
+ a := [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]int{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{42}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
+ got := fmt.Sprint(a)
+ want := strings.Repeat("[", 100) + "42" + strings.Repeat("]", 100)
+ if got != want {
+ fmt.Printf("got %q\nwant %q\n", got, want)
+ }
+}