https://kotlinlang.org logo
#kotest
Title
# kotest
d

dave08

05/19/2021, 12:08 PM
Any reason why
fun <A : Any> Arb.Companion.choose(a: Pair<Int, A>, b: Pair<Int, A>, vararg cs: Pair<Int, A>): Arb<A>
is
A: Any
? It seems like it can't choose from a null?
s

sam

05/19/2021, 12:11 PM
The signature is not null. You must have a null in one of your input arbs
d

dave08

05/19/2021, 12:11 PM
Yeah, that's what I want...
Wondering why it can't just be <A : Any?>
s

sam

05/19/2021, 12:22 PM
Erm, yeah I guess it could be
not sure the Any is needed
d

dave08

05/19/2021, 12:25 PM
In a sense, someone not paying attention could shoot themselves in the foot without it.. getting unexpected nulls. But then, any property testing that isn't well planned is dangerous...
s

sam

05/19/2021, 12:26 PM
d

dave08

05/19/2021, 12:32 PM
Great, thanks!
2 Views