What seems to be happening is that I can't use a generator of int to fill a variable of type interface{} in Box. What I expected to happen is for this to be fine. After all, there's nothing wrong with var i interface{} = 3 so why is there a problem with BoxOf(gen.Int())?
I can work around by using an explicit Map() to change the type of the Int() generator to interface{}:
The following test panics:
What seems to be happening is that I can't use a generator of
int
to fill a variable of typeinterface{}
in Box. What I expected to happen is for this to be fine. After all, there's nothing wrong withvar i interface{} = 3
so why is there a problem withBoxOf(gen.Int())
?I can work around by using an explicit Map() to change the type of the Int() generator to interface{}:
but this feels pretty heavyweight. Is it possible to get structs to accept concrete generators for interface types?