Skip to content
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: variadic function causes panic #21745

Closed
takeyourhatoff opened this issue Sep 3, 2017 · 4 comments
Closed

testing/quick: variadic function causes panic #21745

takeyourhatoff opened this issue Sep 3, 2017 · 4 comments

Comments

@takeyourhatoff
Copy link

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.

@dsnet
Copy link
Member

dsnet commented Sep 3, 2017

I'm unsure what the exact status of testing/quick is. It was on a short-list not long ago of packages to freeze. See #15557.

@dsnet
Copy link
Member

dsnet commented Sep 3, 2017

Ah, yes. It is indeed documented as being frozen:

// The testing/quick package is frozen and is not accepting new features.

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.

@dsnet dsnet closed this as completed Sep 3, 2017
@takeyourhatoff
Copy link
Author

However, we're not extending the API of this package, so I'm going to close this.

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.

@dsnet
Copy link
Member

dsnet commented Sep 3, 2017

I should have said "not extending the feature set" rather than "not extending the API". My mistake.

@golang golang locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants