Closed lmartelli closed 6 months ago
If you find an easy solution, go ahead.
My recommendation, though: Don't dive too deep into type matching code if there is an easy workaround - just use Arbitrary<List<Thing>>
here. There are too many edge cases concerning co- and contravariance that one can easily have one's soul sucked out trying to cover everything. I already lost too many hours of my life in that area :-/
@lmartelli I assume you haven't found a viable solution. Feel free to re-open if I'm wrong.
Testing Problem
A
@Provide
method in a domain that returns aListArbitrary<Thing>
is not used to generate values for a@ForAll List<Thing>
. See https://github.com/jqwik-team/jqwik/compare/main...lmartelli:jqwik:ListArbitrary-providerSuggested Solution
In is lost when navigating to the implemented interface Arbitrary.
net.jqwik.engine.properties.DomainContextBaseProviders.MethodBasedArbitraryProvider#arbitraryType()
the actual generic type parameter of ListArbitraryI am not sure if the mapping can be done in the general case, but it seems safe to say that in the case where there is only one generic type parameter in the class and in the interface, it can be propagated.
I will try to do that.