Add support for function returning tuples
Opened this issue · 3 comments
Functions returning tuples are filtered out in Ir_of_gospel.no_functional_arg_or_returned_tuple
Then it is possible to follow where the code need to be amended as there are some failwith
talking about tuples.
I hand-wrote support for a 6-tuple when I first needed it as part of testing weak hash sets:
https://github.com/ocaml-multicore/multicoretests/blob/7b9b1c123286f1f4db7d13e773f68198ca9b04cd/src/weak/stm_tests_hashset.ml#L112-L122
IIUC, it should be possible to generate similar lines (on demand) from the plugin, if we encounter a returned (or argument?) tuple. 🤔
As QCheck.Print.tup
n are defined up to 9 only, I wondered whether it’s worth the effort of generating them rather than writing them once and for all.
(We might still be gentle and include in the generated file only the required tuples, though)
True, tuples in OCaml APIs are relatively rare - and a 2-digit one more so! 😃
Down the line we may want to extend the support further, e.g., to record types, where a print function is not available.
At that point, ppx_deriving show may be an option.