* LF: Small-step semantics for expression evaluation
This PR factors expression evaluation into two parts:
- a set of evaluation contexts that determine *where to reduce next*
- a set of small-step reduction rules
The PR then redefines the big-step semantics relation as the iteration
of that small-step relation.
The main motivation for this change is to simplify & shorten the
semantics a lot by using evaluation contexts. These contexts not only
determine the evaluation order, they also handle the propagation of
errors from subterms. This means the small-step reduction rules really
only have to deal with redexes, so there's a lot fewer rules.
Incidentally, this change introduces semantics for infinitely looping
terms. Big-step relations generally can't handle infinitely looping
terms, but small-step relations handle them automatically.
I'm not sure if a similar simplification is possible for update
interpretation, but this seems worthwhile for expressions at least.
changelog_begin
changelog_end
* call-by-value, separate app e.c. lines
* split redex evaluation from small-step evaluation
* use kᵪ for erasable kind
* Convert experimental primitive TYPEREP_TYCON_NAME into proper LF builtin
* Add entry for TYPEREP_TYCON_NAME in daml-lf spec
* disable quickcheck test in DA.Test.Packaging
changelog_begin
changelog_end
* Remove unused `name` field from `InterfaceTreeBuilder`, inline builder construction
* Remove unused `Traverse` instance for `TypeDeclOrTemplateWrapper`
* Remove unneccessary type parameter from `TypeDeclOrTemplateWrapper`
* Remove some unnecessary copies `.toList`
* Remove `TypeDeclOrTemplateWrapper`, use `Either` directly as a wrapper
* Use `bimap` instead of explicitly wrapping and unwrapping the `Either`
* Remove unnecessary type `Mode`
* Remove unnecessary type parameter from `WriteParams`
* Remove unnecessary binding
* Pull `OrderedDependencies` out of `Graph`
* Move computation of relevant packages to `codegen-common`
* Move `templateCount` from `LFUtil` into `CodeGen`
* Comment the purpose of `TransitiveClosure`
* Pull the variance cache out of `LFUtil`
`LFUtil`'s purpose is that of limiting passing around certain
values. While the purpose is questionable, the variance cache did
not need to access any of those values and it's quite easy to
move to a separate class where the purpose and the scope are clearer.
* Make `DependencyGraph` work directly on type declarations
* Add constructor for a collection of interfaces to `EnvironmentInterfaces`
* Factor the error message from `cyclicDependencies` out of `DependencyGraph`
changelog_begin
changelog_end
* WIP
* First working version of java codegen daml interface support
* Update language-support/java/codegen/BUILD.bazel
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Fix compile errors
* Simplify code massivly, enjoy less duplication
changelog_begin
- The Java codegen now has basic support for daml interface definitions. Converting a contract id of a template implementing an interface to a contract id of the interface is possible and both executing interface choices is possible on the contract id of the interface and implementing template.
changelog_end
* Rename the test file to reflect it is a test file & enhance the inner test name & extend it further
* Fix test
* Refactor parts of TemplateClass.scala into multiple files
* Format that files!
* Minimize duplication further
* Remove unused comment
* Simplify code
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
* Update language-support/java/codegen/src/main/scala/com/digitalasset/daml/lf/codegen/CodeGenRunner.scala
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
* Further refactoring and renaming of the TemplateClassSpec to ContractIdClassBuilderSpec
* Fix formatting
* Add interface docs
* Remove unnecessary code generation of the Contract class for interface types
* Use less bool flags and more good function names :)
* Fix build
Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
* ifaces: more evaluation order tests
This adds more evaluation order tests for the execution of daml-lf
during exercise_interface.
Part of #12697.
CHANGELOG_BEGIN
CHANGELOG_END
* Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/EvaluationOrderTest.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/EvaluationOrderTest.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Remy <remy.haemmerle@daml.com>
* ifaces: Add exercise interface semantics to spec
This is based on the semantics of 'exercise'.
Closes#11349 (for now). Also fixes a small bug in the semantics of 'exercise'.
changelog_begin
changelog_end
* Uniformize exercise syntax
This add a first test for evaluation order of exercise_interface and
fetch_interface. More tests will come in the following PR's.
This is part of #12697.
CHANGELOG_BEGIN
CHANGELOG_END
We add tests to check that by_interface fields are set for interface
transactions. We also extend the scenario service to show the
by_interface fields in the pretty printed transactions.
Fixes#13333
CHANGELOG_BEGIN
CHANGELOG_END
* explore less bouncing; convert every: Bounce -> yesBounce/noBounce
changelog_begin
changelog_end
* remove noBounce; yesBounce -> Bounce (with curly braces)
* multi args list for better layout
* use shadow variable naming more consistently
* reduce unnecessary polymorphism
* reinstate 2x Bounce in atomizeExps which are necessary
* avoid 2x linear args.size
* avoid pointless conversion to/from Array
* move definition of Res to correct place
* remove 2x comments to type param A which has been removed
* inline 2x unnecessary val defs
* enable Anf stack-safety tests for EUpdate cases
* fix stack-safety for closures in Anf transform
* fix stack-safety for try-catch handling in Anf transform
* add missing testcases for scope-exercise/prevernt-catch ANF stack-safety, and fix the overflow
changelog_begin
changelog_end
* interfaces: tests for requires typing
We add tests for the correct typing of the interface requires field.
CHANGELOG_BEGIN
CHANGELOG_END
* security evidence
This adds the presence of interface names, as well as lists of choices
and their argument/return types for each interface.
It also changes the semantics of DefTemplate and EnvironmentInterface:
each may contain "unresolved choices", which are the choices inherited
from interfaces for each implementing template;
EnvironmentInterface#resolveChoices will copy the full type information
as a concrete choice for each implementing template, which should be
much simpler for codegen and json-api.
A type generator should take account of the astInterfaces as well as
typeDecls in EnvironmentInterface; interfaces aren't included in
typeDecls because where I is an interface only ContractId I is
serializable.
* Ast.DataInterface is empty, just use the interfaces map directly
* port json-api for interface API changes; does not solve #12689
* port Scala codegen for interface API changes; does not add support
* port Java codegen for interface API changes; does not solve #11350
CHANGELOG_BEGIN
CHANGELOG_END
This extends the Scala encoder tests to include interface definitions
and interface implementatioins. Some bugs in the encoder and ast
rewriter are fixed.
CHANGELOG_BEGIN
CHANGELOG_END