mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
4c1b4842f4
* exerciseArchive(Archive) was skipped before by the flattening rules because Archive is defined in a separate package. By flattening across packages in this PR, Archive is now a valid candidate. * The new Exercises.Archive interface is a superinterface of most generated exercise* method sets, and therefore generated ContractIds, CreateAnds, and ByKeys, giving a LUB to different contract types that contains the exerciseArchive method. - This is most, not all, because the Daml-LF rules determine what codegen ought to do, and Daml-LF does not mandate an Archive method of any kind, never mind one in the exact shape that we happen to generate. - If an Archive is present, and it has an empty record as its parameter and Unit as its result type, then we can safely assume that the exerciseArchive method is sensible to include in the type. - However, this still excludes the generic ContractId type, because generic ContractId does not have enough data to generate a Daml-LF-correct Archive command given the unknowns mentioned above. So we simply exclude it from the type instead of guessing the argument and hoping the guess is close enough. That's why the Exercises.Archive type is available to users who want access to the method, which is a supertype of codegenned contract IDs among other things mentioned above: SimpleTemplate.ContractId cid = new SimpleTemplate.ContractId("id"); Exercises.Archive<?> wideCid = cid; assertEquals( wideCid.exerciseArchive().commands(), cid.exerciseArchive(new Archive()).commands()); |
||
---|---|---|
.. | ||
codegen-common | ||
codegen-main | ||
hs/bindings | ||
java | ||
scala | ||
ts |