Closed 0x53A closed 4 years ago
Closing due to a workaround being available or lack of popular demand. This allows us to better focus on high impact issues. If you feel this is blocking you, you may add a comment here to explain why this should be prioritized.
Thank you for your understanding.
I would like to be able to automatically generate values for simple DUs in F#.
By simple, I mean DUs which are either enums
type T = A | B | C
or only contain primitive members which themselves are supported (e.g. enums, bools, ...):
type T2 = A of bool | B | C of T
Would you, in principle, be open to include functionality like this? If you don't mind, I can try to add it myself (but it might take some time).
There are existing Reflection functions to ask if a type is a DU, and to get it's cases in FSharp.Core. Would it be ok for you if I add a reference to it? It is sometimes a bit of a pain, because if multiple versions of FSharp.Core are included somewhere else, then the consumer may need to add a binding redirect, but in this case I think it shouldn't be an issue, since it would only be called from the testrunner.
Otherwise I can try to emulate it via normal reflection from C#.