-
Notifications
You must be signed in to change notification settings - Fork 18k
testing/quick: variadic function causes panic #21745
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
Comments
I'm unsure what the exact status of |
Ah, yes. It is indeed documented as being frozen: Line 7 in e25fdb9
Given that this panic occurs because of a function signature entirely within the control of the user is passed to the package, I would consider this a feature request to add support for variadic functions. However, we're not extending the API of this package, so I'm going to close this. Thanks for reporting. Feel free to fork and develop quick further if you use the package heavily. |
A fix will not extend the API of the package, and will not break existing programs because the only ones that the fix will affect will panic right now. I don't mind if this stays closed but fixing this would not require changing the API of testing/quick. |
I should have said "not extending the feature set" rather than "not extending the API". My mistake. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.9
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?Linux amd64
What did you do?
Try to call quick.Check(f, nil) where f has a variadic argument
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/7jvo72sHT5
What did you expect to see?
"Check looks for an input to f, any function that returns bool, such that f returns false."
No panic.
What did you see instead?
panic: reflect: cannot use []int as type int in Call
goroutine 1 [running]:
reflect.Value.call(0x1304a0, 0x164d14, 0x13, 0x1451c5, 0x4, 0x1050a0c0, 0x1, 0x1, 0x0, 0x0, ...)
/usr/local/go/src/reflect/value.go:382 +0x1280
reflect.Value.Call(0x1304a0, 0x164d14, 0x13, 0x1050a0c0, 0x1, 0x1, 0x105442a0, 0x14ba01, 0x0, 0x0)
/usr/local/go/src/reflect/value.go:302 +0xc0
testing/quick.Check(0x1304a0, 0x164d14, 0x0, 0x0, 0x113ca0, 0x7f47)
/usr/local/go/src/testing/quick/quick.go:289 +0x2c0
main.main()
/tmp/sandbox034499881/main.go:9 +0x40
Program exited.
The text was updated successfully, but these errors were encountered: