Commit Graph

525 Commits

Author SHA1 Message Date
Miklos
f5c84a2aa4
Daml-LF: Damlification of Scala/Haskell files (#9666)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-20 09:52:33 +02:00
Sofia Faro
1794a6f969
Refactor GenerateStablePackages (#9744)
* Refactor GenerateStablePackages

Summary of changes:

* Split GenerateStablePackages executable into a library (containing the stable package data) and an executable (that writes out the packages)

* Hook up data-dependencies test to the new library so we don't have to manually update the number of stable packages every time we add a stable package or release a new LF version.

changelog_begin
changelog_end

* buildifier-fix
2021-05-19 13:57:09 +01:00
Moritz Kiefer
bb5dd4cbf3
Fix locking of envScenarioContexts (#9736)
This fixes a race condition in our handling of scenario contexts. See
the comments for details. I verified with a bunch of extra logging
that this is what is actually failing in our tests. I’ll try to
upstream the logging separately since ideally I’d like to have that in CI.

I ran all integration tests with --runs_per_test=20 over night and
with this change I’m no longer able to get it to flake so dropping the
flaky marker.

fixes #6910

changelog_begin
changelog_end
2021-05-19 12:51:30 +02:00
Sofia Faro
b55613be6c
Parallelize the data-dependencies test. (#9733)
* Parallelize the data-dependencies test.

It runs about twice as fast on my laptop (240s -> 120s) when allowed to
run tests in parallel. I'm not sure this will work or make a huge
difference when it comes to timeouts in CI, but it's worth a shot.

changelog_begin
changelog_end

* TASTY_NUM_THREADS := 3

* set bazel tag for test
2021-05-19 10:03:00 +00:00
Moritz Kiefer
6245e3456c
Drop damlc integration test todo (#9735)
I have no idea what this is supposed to mean. I suspect it’s leftover
from Daml < 1.1 or something like that.

changelog_begin
changelog_end
2021-05-19 11:26:46 +02:00
Moritz Kiefer
2dbfe433b4
Fix conversion of TryContextInfo in scenario service (#9731)
There are two options here:

1. We unwind to the nearest parent exercise. This is what I
implemented.
2. We show the try context. At first it seems like this exposes more
information but really it doesn’t. You cannot locate the try so it’s
fairly meaningless.

A solution here could be to show the full context
stack instead but that’s a separate issue which I do not want to
tackle atm.

changelog_begin
changelog_end
2021-05-19 09:15:33 +02:00
Sofia Faro
9d23b4337f
Split DA.Internal.Exception.Types into three packages. (#9709)
* Split DA.Internal.Exception.Types into three packages.

I think this is a good idea because it means the user can disambiguate between these modules in daml. All three types define a `message` field, so if the programmer wants to refer to the field for one of these types specifically, it's nice to have a canonical way to disambiguate them (by module name).

Also the module names show up in the error message for uncaught exceptions. These names are a bit nicer than "DA.Internal.Exception.Types".

Decoupling these types just sounds like a good idea going forward.

changelog_begin
changelog_end

* buildifier-fix

* update isInternal

* Update tests

* Use more general pattern in CommandServiceIT

* Update DarReaderTest
2021-05-18 18:42:11 +00:00
Moritz Kiefer
0a1d00d1b3
Canonicalize junit output path (#9710)
fixes #9646

changelog_begin
changelog_end
2021-05-18 12:34:53 +02:00
Remy
d4fca0305b
LF: Change error exception for Arithmetic builtins (#9692)
This PR is a priliminary step toward making Arithmetic Builtin
throwing proper Daml Excetpions.

This is part of #8020.

CHANGELOG_BEGIN
CHANGELOG_END
2021-05-18 10:41:44 +02:00
Sofia Faro
7a97d88f42
DA.BigNumeric: Split shift, add roundToNumeric. (#9702)
* Split BigNumeric.shift, add BigNumeric.roundToNumeric.

This is based on some feedback we received. The shift direction was
counterintuitive so splitting `shift` into `shiftLeft` and `shiftRight`
makes this more explicit. It's also convenient to have a function that
combines the rounding and casting of BigNumeric to a specific Numeric
scale.

changelog_begin

- [Daml Standard Library] `DA.BigNumeric.shift` has been split into
  `DA.BigNumeric.shiftLeft` and `DA.BigNumeric.shiftRight`.
  `DA.BigNumeric.roundToNumeric` is introduced, for rounding and
  converting a BigNumeric to a Numeric in a single move.

changelog_end

* hide `round` in DA.BigNumeric

* Simplify error docs, add doctest for roundToNumeric

* Update BigNumeric test
2021-05-17 15:43:27 +00:00
Miklos
395ff58eec
Damlification of Bazel files (#9670)
CHANGELOG_BEGIN
CHANGELOG_END
2021-05-17 11:41:44 +02:00
Sofia Faro
6568336588
Lift constraint tuples up to a type synonym in data-dependencies. (#9687)
* Lift constraint tuples up to a type synonym in data-dependencies.

Fixes #9663 and adds a regression test.

GHC was crushing the constraint tuples into regular constraints, so the function caller no longer matched the original LF API. By lifting the constraint tuple into a type synonym, we eliminate this effect.

Part of the issue here is that we're losing the original constraint tuple type synonym during LFConversion. I'll open a separate issue for that, since I think it's also worth fixing that going forward.

(Preserving the type synonym would solve this issue for newly compiled packages. By contrast, the fix in this PR works for both new and old packages.)

changelog_begin

- [Daml Compiler] Fixed a data-dependencies bug where functions in a data-dependency that used a constraint tuple constraint (e.g. `Template t`) could not be directly invoked.

changelog_end

* use foldl'

* Fix exception test that spawned this mess
2021-05-14 14:22:47 +01:00
Sofia Faro
55abd0b7f0
Add a data-dependencies test for user-defined exceptions (#9659)
* Add a data-dependencies test for exceptions.

Part of #8020

This only tests that (catching & throwing) user-defined exceptions compiles as expected across data-depndencies.

Once they're supported, we should also add a test involving throwing a built-in exception (arithmetic or contract errors) in the data-dependency and catching them in main.

changelog_begin
changelog_end

* Fix weird formatting

* Rename test case

* syntax error

* fix easy problems

* Work around constraint tuple bug.
2021-05-13 15:40:29 +01:00
Moritz Kiefer
d6d01b04ef
Swap order SEScopeExercise and SBUBeginExercise (#9621)
* Swap order SEScopeExercise and SBUBeginExercise

SEScopeExercise pushes the KCloseExercise continuation. However, the
corresponding transaction node is only inserted when SBUBeginExercise
finishes. This causes an issue if SBUBeginExercise crashes/throws an
exception.

changelog_begin
changelog_end

remove weird comment

changelog_begin
changelog_end

Reenable another test

changelog_begin
changelog_end

* Update failing test

changelog_begin
changelog_end
2021-05-10 19:25:55 +02:00
Sofia Faro
9242540022
Make error throw a GeneralError. (#9613)
* Make error throw a GeneralError.

As well as abort, fail, etc.

changelog_begin
changelog_end

* keep the error message when you have an unhandled error in scenario

* Disable crashing opsem tests for now.

* Update CommandServiceIT regex pattern.

* Put | in wrong place :-|

* forgot to escape "

* Illegal repetition!
2021-05-10 10:47:43 +01:00
Sofia Faro
fd62671e0b
Introduce SINCE-LF-FEATURE in integration tests. (#9616)
* Introduce SINCE-LF-FEATURE in integration tests.

The idea being to avoid hardcoding LF feature version numbers in the integration tests, so we don't have to remember to update them once a feature comes out of 1.dev

changelog_begin
changelog_end

* Show list of features on error
2021-05-07 12:27:12 +00:00
Moritz Kiefer
c570a5ff2c
Fix BigNumeric literal validation (#9562)
* Fix BigNumeric literal validation

The calculation of scale is off and fails on
0.123456 which turns into 1929 % 15625.

I don’t really like the implementation here but I’m failing to come up
with a more direct way to calculate it. I blame the fact that I
haven’t had coffee yet.

changelog_begin
changelog_end

* Address review comments

changelog_begin
changelog_end

* Apply suggestions from code review

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

* Fix test

changelog_begin
changelog_end

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-05-04 14:55:00 +02:00
Moritz Kiefer
312ed6979c
Fix numeric docs for shift and add a few tests (#9564)
changelog_begin
changelog_end
2021-05-04 11:35:17 +00:00
Robin Krom
84359ffa73
nested record updates (#9505)
* record dot updates: update to new ghc-lib-parser

This updates the ghc-lib-parser library featuring record dot updates and
adds tests for the new feature.

CHANGELOG_BEGIN
CHANGELOG_END

* update snapshot after pin on windows

* added a test for error locations

* nested record puns test

* update ghc commit

* update of stack dependencies (linux)

* update stack snapshot(windows)
2021-05-03 16:27:01 +02:00
Sofia Faro
a5d1e185ab
Move builtin exceptions to a stable package. (#9523)
* Move builtin exceptions to a stable package.

This PR moves the built-in exceptions (GeneralError, ArithmeticError, ContractError) to a stable package in daml-prim, in preparation for removing them from LF proper.

Part of #8020.

changelog_begin
changelog_end

* Update tests

* rename the module

* couple that got away

* update hash

* Update dar reader test.

* typo

* questionable lint
2021-04-29 10:19:20 +00:00
Moritz Kiefer
4e1c5fedb3
Check visibility for by-key operation of local contracts (#9470)
* Check visibility for by-key operation of local contracts

fixes #9454

I tried out two approaches for this:

1. The one here where we add a new callback. This has the advantage
   that the engine remains oblivious to visibility checks. They are all
   done outside and the engine doesn’t even know about the reading
   parties.
2. Make the engine aware of the reading parties. A start of that is in
   #9458.

Both work in principle but I ended up going for 1 in the end. Doing
half of the visibility checks outside the engine and half inside just
seems worse than the current state.

changelog_begin

- [Daml Engine] Fix a bug where it was possible to
  fetch/lookup/exercise a local contract by key even if the reading parties
  are not stakeholders. See #9454 for details.

changelog_end

* Disable new test on Canton

changelog_begin
changelog_end

* Exclude from compat tests

changelog_begin
changelog_end

* s/LocalLookup/LocalFetch/

changelog_begin
changelog_end

* Address review

changelog_begin
changelog_end
2021-04-22 21:39:12 +02:00
Moritz Kiefer
524d43eacb
Support rollback nodes in scenario service (#9410)
This focuses on the semantics rather than the display in Daml Studio
which needs more work (and seems not all that important at this
stage).

This already uncovered a bug which also applies outside of scenarios:

The consumedBy field was not affected by rollbacks which breaks the
mustBeActive check in partial transactions. This PR fixes this by
caching on try and restoring on rollback.

changelog_begin
changelog_end
2021-04-22 12:52:33 +02:00
nickchapman-da
ffdb71d32a
Create rollback nodes (#9367)
* recode contractValuesInOrder in RollbackTest

* first stab at creating rollback node; tests updated

* Rollback nodes are transparent for the cid scheme

* deativate failing exception tests

changelog_begin
changelog_end

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2021-04-14 18:51:35 +02:00
Sofia Faro
1627b70427
Pattern matching for RoundingMode (#9381)
* Pattern matching for RoundingMode

- Fix the order of RoundingMode constructors in GHC.Types to match the LF built-in order. Try to match this order across all code and documentation, and added a test for this order.
- Implements pattern matching for RoundingMode. The added machinery could also be useful for solving #5753 in the future.
- Implements Show instance for RoundingMode. (Mainly so we can use them in tests.) Moved BigNumeric Show instance to GHC.Show.

changelog_begin
changelog_end

* mkScrutineeEquality typo

* fix roundingModeLiteralMap order

* Use custom type for building case body

* Factor GeneralisedCaseAlternative into GeneralisedCasePattern

* Fix finalize

* Remove unused bindings
2021-04-13 15:47:16 +00:00
Robin Krom
8480032d85
daml package: bump timeout for tests (#9377)
CHANGELOG_BEGIN
CHANGELOG_END
2021-04-12 09:45:32 +00:00
Robin Krom
f84b6abc05
daml build: add a --access-token-file for remote dependencies (#9358)
* daml build: add a --access-token-file for remote dependencies

This adds a `ledger.access-token-file` field in the `daml.yaml` project
file and a `--access-token-file` flag to `daml build` to authorize
querying/fetching of remote dependencies.

CHANGELOG_BEGIN
[daml build] A new flag `--access-token-file` is added for the `daml
build` command. It allows the specify the path to an access token to
authenticate against the ledger API. This is needed if the project
depends on a remote Daml package hosted on such a ledger. Alternatively,
the path to the token can also be specified in the `daml.yaml` project
file under the `ledger.access-token-file` field.
CHANGELOG_END
2021-04-08 23:20:52 +02:00
Sofia Faro
06701f7d5e
Expose rounding modes as constructors + add BigNumeric docs. (#9336)
* Expose rounding modes as constructors.

This PR exposes the rounding modes as constructors for RoundingMode. Pattern matching for RoundingMode is not implemented and not critical (will open a separate issue).

This PR also adds documentation for BigNumeric.

changelog_begin
changelog_end

* Fix rounding mode literals

* Update data-types.rst

* expose constructors

* expose constructors (part 2)

* Update compiler/damlc/daml-prim-src/GHC/Types.daml

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Try to improve `Numeric n` description.

* Add message for RoundingMode match and a test.

* Restrict RoundingMode test to 1.dev

* Update version numbers to 1.13

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-04-07 14:58:31 +00:00
Remy
568a8528a8
LF: release preview of LF 1.13 (#9329)
CHANGELOG_BEGIN
- Daml: (Early access) add support for BigNumeric
CHANGELOG_END
2021-04-07 12:42:54 +02:00
Sofia Faro
f2e0464227
Add BigNumeric literals in Daml. (#9289)
* Add BigNumeric literals in Daml.

Adds support for BigNumeric literals (when available). Only literals that will fit in a single Numeric are supported for now.

I introduced the `IsNumeric t` typeclass because this is an easy way to restrict `fromRational` without moving it into its own typeclass. (Moving it into a typeclass causes some gnarly problems with the specializer -- it starts creating references to GHC.Real in an attempt to optimize the invocation, and that's a problem because  GHC.Real doesn't exist in LF.)

I then added the "fromNumeric" and "fromBigNumeric" conversion functions in that class, since they seem really convenient, and it also means we could in the future make it so that any type that implements `IsNumeric` gains literals (via Numeric or BigNumeric literals). This would improve a lot of Numeric code, since it eliminates the need to annotate types so often! But for now only Numeric and BigNumeric literals are supported.

changelog_begin
changelog_end

* lint

* Add test for too large bigNumeric
2021-03-31 13:39:39 +00:00
Robin Krom
b4bda47e7d
remote pkgs: resolve package names in data dependencies via ledger (#9270)
* remote pkgs: resolve package names in data dependencies via ledger

This implements part 3) of #8976.

This adds the ability to specify package names/versions in daml.yaml in
the data-dependencies stanza. They are being resolved via the project
ledger and a daml.lock lock file.

CHANGELOG_BEGIN
  [remote dependencies] Package names and versions, as well as package
  ID's are allowed in the `data-dependencies` list of `daml.yaml`. These
  packages are fetched from the project ledger. The auto-generated
  `daml.lock` file keeps track of the package name/version to package
  ID's resolution and should be checked in to version control of the
  project.
CHANGELOG_END

* added docs

* Update compiler/damlc/lib/DA/Cli/Damlc/DependencyDb.hs

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Update docs/source/daml/reference/packages.rst

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* suggestions

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2021-03-31 15:37:36 +02:00
Andreas Herrmann
4edefbc2d9
Generate DALFs for data-dependencies in Daml script dump (#9265)
* Don't mark dalfs in data-dependencies as main dalfs

This causes the LF version consistency check to fail on DALF data
dependencies that were generated with a different LF version and also
occur in dalfsFromDependencies. E.g. a dalf like `daml-prim-DA-Types`
triggers this issue.

changelog_begin
- [DAML Compiler] DALFs in data-dependencies that are imported directly
  now require corresponding `--package` flags to make them visible. The
  reason for this is that DALFs that are data-dependencies are no longer
  treated as main DALFs.
changelog_end

* Daml script dump write DALFs instead of DARs

Produces DALFs for dependencies and adds them to the data-dependencies.
Package flags for main DALFs are added to the build options.

* Update test-cases

* address review

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-03-31 10:14:56 +02:00
Sofia Faro
f670daec6f
Add try-catch syntax. (#9203)
* Add try-catch syntax.

changelog_begin
changelog_end

* ++

* +++

* ++[>++<-]>

* ++[>++<-]>+

* ++[>+++<-]>

* ++[>+++<-]>+

* ++[>++++<-]>

* Use try-catch in ExceptionSyntax test

* add a syntax test for try catch

* +++[>+++<-]>

* +++[>+++<-]>+

* enable test4

* typo

* add a test with multiple patterns and guards

* final patch sha

* update stack snapshot (unix)

* update stack snapshot (win)
2021-03-25 13:36:09 +00:00
Moritz Kiefer
39377e88d6
Add unique(on)? to DA.List.BuiltinOrder (#9233)
changelog_begin

- [Daml Stdlib] Add unique(on)? as more efficient versions of unique,
  uniqueOn using the builtin daml-lf ordering.

changelog_end
2021-03-25 13:14:15 +01:00
Moritz Kiefer
a8cb170ed1
Add Ord instances for Any(Template|Choice|ContractKey) (#9224)
* Add Ord instances for Any(Template|Choice|ContractKey)

This is useful to use them as map keys. We have a large application
that currently does a linear search over a potentially very large set
of contracts which can be replaced with a map lookup with this.

changelog_begin
changelog_end

* Match builtin equality for Any(Template|Choice|ContractKey)

changelog_begin
changelog_end

* Use primitives directly

changelog_begin
changelog_end
2021-03-24 16:33:14 +01:00
Moritz Kiefer
81c710f8fc
Add DA.List.BuiltinOrder module (#9226)
This provides variants of `dedup*` and `sort*` which rely on Daml-LF’s
builtin ordering (using Map internally). I don’t have microbenchmarks
but even in macrobenchmarks this is a measurable improvement which
isn’t particularly surprising.

changelog_begin

- [Daml Stdlib] Add `DA.List.Builtinorder` module. This module provides
  variants of `sort*` and `dedup*` which rely on Daml-LF’s builtin
  ordering and are significantly more efficient in some cases.

changelog_end
2021-03-24 16:33:05 +01:00
Moritz Kiefer
90c5ce703a
Optimize mapOptional and add more efficient findOptional (#9214)
* Optimize mapOptional and add more efficient findOptional

Given that we don’t have list fusion catOptionals . map f is clearly
less efficient than this version.

I also added findOptional which can be pretty handy in certain cases.

changelog_begin
changelog_end

* more foldr

changelog_begin
changelog_end

* fix tests

changelog_begin
changelog_end
2021-03-23 17:07:45 +00:00
Robin Krom
f89aa294e5
damlc pkg: use cache for already present packages (#9193)
* damlc pkg: use cache for already present packages

This only downloads packages from a remote ledger, if the package is not
already present in the dependency db as a normal dependency.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-22 13:57:38 +01:00
Robin Krom
8c64f120da
pkgid data deps (#9153)
* damlc: Allow package IDs in data-dependencies.

This is the next step outlined in issue #8976. If package id's are
present in the `data-dependency` section of the daml.yaml file, we try
to fetch them (and their transitive dependencies) from the default
ledger of the project.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-18 12:17:38 +01:00
Sofia Faro
c26c349c8b
Generate exception instances from syntax. (#9140)
* Generate exception instances from syntax.

changelog_begin
changelog_end

* II

* III

* VII

* update ghc patch and add test

* VIII

* IX

* Remove DatatypeContexts

* X

* update stack snapshot

* don't need datatypecontexts warning anymore

* X-2

* XII

* XIII
2021-03-17 12:19:22 +00:00
Robin Krom
7669d8c88c
daml pkg: split installation of deps and package db inititialization (#9056)
* daml pkg: split installation of deps and package db inititialization

This is the next step for the daml package manager program #8976.
This splits the installation of dependencies from the initialization of
the (ghc) package database.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-12 22:55:11 +01:00
Sofia Faro
e538f2d676
Add DA.Exception and enable LF primitives. (#9082)
- Add `DA.Exception` module that re-exports `DA.Internal.Exception`
while hiding the `DamlException` class.

- Uncommented out the primitive calls in `DA.Internal.Exception`, so
the standard library is actually calling the underlying LF primitives.

- Expanded the `ExceptionDesugared` test to actually throw and catch
an exception. :-)

changelog_begin
changelog_end
2021-03-11 11:42:16 +00:00
Sofia Faro
e6ea8fa9b3
Start adding exception syntax support. (#8960)
* Start adding exception syntax support.

changelog_begin
changelog_end

* .

* ..

* . .

* ....

* .___.

* ..__..

* ._._._.

* update stack snapshot

* recompile ghc-lib

* update stackage

* add CmmParse patch

* incorporate CmmParse.y patch into ghc branch

* Add a first test for exception syntax desugaring.

* Add a test for multiple message declarations

* update ghc patch

* Update duplicate message test with location

* add brackets test

* Add final patch SHA

* update stack-snapshot and unpin for unix

* Update stackage pin on windows
2021-03-10 12:07:53 +00:00
Moritz Kiefer
0281b442b8
-Werror all the things (#9027)
We used to do this for some packages but it broke cpp. I don’t
actually know why it doesn’t do that anymore but I’ll gladly accept
that fact and turn it on everywhere.

changelog_begin
changelog_end
2021-03-04 19:08:59 +01:00
Moritz Kiefer
2c08586d33
Expose Daml stacktraces for Daml Script errors (#9025)
* Expose Daml stacktraces for Daml Script errors

This finally plugs together the pieces from the previous PRs to
provide stacktraces on any ScriptF command (and thereby anything
involving an interaction with the ledger).

fixes #8754

changelog_begin

- [Daml Script] When running Daml Script on the command line you will
  now see a Daml stacktrace on failures to interact with the ledger
  which makes it significantly easier to track down which of the calls
  fails. By default, you will only get the callsite of functions like
  `submit`. To extend the stack trace, add `HasCallStack` constraints
  to functions and those will also be included.

changelog_end

* Fix non-determinism in tests

changelog_begin
changelog_end

* fmt

changelog_begin
changelog_end
2021-03-04 16:13:50 +01:00
Moritz Kiefer
e5421288d9
Improve errors on duplicate record field names (#9010)
* Improve errors on duplicate record field names

fixes #8994

changelog_begin
changelog_end

* Apparently I was wrong about names

changelog_begin
changelog_end

* hlint

changelog_begin
changelog_end

* newlines don’t render well in daml build

changelog_begin
changelog_end

* maybe I should test if my code compiles before pushing

changelog_begin
changelog_end
2021-03-04 10:13:24 +01:00
Robin Krom
7490832966
damlc-test: add 'large' label to BUILD (#8997)
Hopefully this gives the tests more time to complete on the mac nodes.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-03 11:38:57 +00:00
Robin Krom
11ec339f6f
feature: damlc lints all files in project directory (#8979)
* feature: damlc lints all files in project directory

fixes #8887.

This changes the input options of `damlc lint` to take several files. If
no file is given, all `.daml` files contained in the directory are
linted.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-02 15:50:57 +01:00
Moritz Kiefer
514bf2597e
Include table view for failed scripts (#8967)
fixes #8966

changelog_begin

- [Daml Studio] Failed scripts (and scenarios) now also offer the
  option to view the table view at the state before the failing
  transaction to ease debugging.

changelog_end
2021-03-01 09:58:01 +01:00
Robin Krom
012b04368d
damlc test: feature: add --all flag. (#8919)
* damlc test: feature: add --all flag.

This adds a flag `--all` that will test all present scenarios/scripts in
the code and also report code coverage with respect to all present
templates/choices, whereas without the flag, code coverage is reported
relative to a single package.

CHANGELOG_BEGIN
[damlc test] Added a `--all` flag to test all present scripts/scenarios.
CHANGELOG_END
2021-02-26 18:44:40 +01:00
Moritz Kiefer
275eaedd2a
Fix closure references in Daml Repl (#8950)
* Fix closure references in Daml Repl

Turns out the comment "we probably need to extend this to merge the
modules from each line" was exactly correct: If the result evaluates
to a closure (or a value including a closure), it can reference
definitions from the current module. This happens if the simplifier
lifted something out of the current definition (otherwise we have only
one and it cannot be recursive so no chance of leaking a reference).

This PR fixes this by checking whether the result references the
current module and if it does, we keep it around.

changelog_begin
changelog_end

* Address review comments

changelog_begin
changelog_end

* fmt

changelog_begin
changelog_end
2021-02-26 13:29:42 +00:00