0
1
mirror of https://github.com/golang/go synced 2025-04-15 00:35:44 +00:00
Files
Robert Griesemer 99e4ddd053 cmd/compile: increase nesting depth limit for type descriptors
The formatting routines for types use a depth limit as primitive
mechanism to detect cycles. For now, increase the limit from 100
to 250 and file  so we don't drop this on the floor.

Also, adjust some fatal error messages elsewhere to use
better formatting.

Fixes .
Updates .

Change-Id: Idd529f6682d478e0dcd2d469cb802192190602f6
Reviewed-on: https://go-review.googlesource.com/c/154583
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 00:13:58 +00:00

23 lines
882 B
Go

// 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)
}
}