New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing/quick: stack overflow for recursive types #8818
Comments
I'm happy to take care of this if we can decide on the correct behavior. |
My 2c (not the final word): It seems reasonable in general for If you work on this, please be sure to also test mutually recursive types: type (
R struct{ r *R }
S struct{ t *T }
T struct{ s S }
)
// Issue 8818
// Generating values for recursive types used to hang.
func TestRecursiveType(t *testing.T) {
if _, ok := Value(reflect.TypeOf(&R{}), rand.New(rand.NewSource(0))); !ok {
t.Error("failed to generate recursive value")
}
if _, ok := Value(reflect.TypeOf(&S{}), rand.New(rand.NewSource(0))); !ok {
t.Error("failed to generate mutually recursive value")
}
} |
@bradfitz who is the right person to decide what the correct behavior is here? |
@robpike do you have an opinion here, or a 301? |
@agl is the original author. Ask him. |
The documentation for quick.Value says: "Value returns an arbitrary value of the given type". Not generating nil pointers seems more like a bug than what was intended? |
CL https://golang.org/cl/10821 mentions this issue. |
The text was updated successfully, but these errors were encountered: