Handle Variant-without-arguments correctly in daml ledger export
#15153
Open
Description
Relates to #14723
There's another problematic case,
Variant(variantId = V, constructor = C, value = Unit)
This could represent a value of variant type V
with constructor C
, where C
takes no arguments, e.g.
data V = A Int | B Text | C
var : V
var = C
or a value of variant type V a
with constructor C a
, where a ~ ()
, e.g.
data V a = A Int | B Text | C a
var : V ()
var = C ()
There is no way to tell these apart without the type information at hand. We could make the value
field of Variant
optional, leaving value
unset for the former case and set as Unit
for the latter, but it's currently commented as Required in https://github.com/digital-asset/daml/blob/main/ledger-api/grpc-definitions/com/daml/ledger/api/v1/value.proto#L146-L148