fixes#10570
I’m increasingly convniced, that the future failures here are a
maintenance nightmare and we should switch to Either completely but
not in this PR
changelog_begin
changelog_end
Requested in #10509. Should we also add `minimumBy` and `maximumBy` for
consistency with `sortBy`?
CHANGELOG_BEGIN
- The DA.List and DA.List.Total modules now export minimumBy, maximumBy,
minimumOn and maximumOn, respectively behaving similarly to sortBy and
sortOn.
CHANGELOG_END
* feature: persist script view config in worspace
This fixes#9188. We remember the config for the script view in the
workspace state. This way script results can be closed and reopened with
the same view config. This also works across restarts of Daml studio.
CHANGELOG_BEGIN
[Daml studio] The script view configuration is remembered for each
script in a workspace and does not need to be reconfigured upon
closing/reopening or restarting of Daml studio.
CHANGELOG_END
* removal of unused imports
* Add dlint rule to suggest ===
This rule doesn’t quite work in all cases since you can have types
that have Eq instances but not Show instances. However, I think the
benefits of people learning about this are much larger than the
downsides here of getting a hint that doesn’t apply in edge cases.
changelog_begin
changelog_end
* fix all the tests, why are there so many :(
changelog_begin
changelog_end
* feature: remember checkboxes in script view
Fixes#9177. This makes the script view remember the choices for
'show_archive', 'show detailed disclosure' and 'table/transaction' view
accross changes to the script.
CHANGELOG_BEGIN
[daml studio] The script view now remembers checkboxes for detailed
disclosure view and archived contracts across script changes.
CHANGELOG_END
* factor out hide/show class code
* more factoring
* Allow imports of internal modules
changelog_begin
- [Daml Compiler] Imports of internal modules from stable packages are
no longer illegal. Previously, the compiler raised an error when it
encountered imports of internal modules such as
`DA.Internal.Template`. Such imports are now accepted by the compiler.
Note, however, that internal modules are still not part of the stable
API. Fixes https://github.com/digital-asset/daml/issues/10379
changelog_end
* ~unstable~
https://github.com/digital-asset/daml/pull/10397#discussion_r676485891
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
The conversion of SValue to Value already ensures the resulting value
has a serializable type. Here we add a check to ensure it does not
overpass the maximum allow nesting.
* Pass commitLocation along in engine warning log.
changelog_begin
changelog_end
* Use commitLocation in diagnostics.
* scalafmt
* update divulgence test
* Fix commitLocation and expected diagnostic locations
* Register divulgence warnings as diagnostics
The divulgence warnings for a scenario are registered as a diagnostic,
when there isn't a scenario error. (Rationale: Scenario errors already
include the warnings in their text, after trace log entries.)
Part of #9947, follow up from #10253
changelog_begin
changelog_end
* Rewrite case expression to make it more readable
* Fix a couple integration tests
* Remove Optional[Location] field from transaction nodes.
xoptLocation
working but very messy!
cleanup PartialTransaction code
pass locationInfo in CompleteTransaction
dont pass locationInfo in SumittedTransaction
pass optLocation to CheckAuthorization
temp reinstate xoptLocation in ExerciseContextInfo
cleanup Conversions.scala
remove Optional[Location] field from transaction nodes.
CHANGELOG_BEGIN
CHANGELOG_END
* fix bad merge
* fix build after merge
* rename
* doc comment, and question
* Separate traces from warnings in engine.
I decided to separate the engine warnings from the tracelog after all,
because I think it will make testing and maintenance easier in the
long run.
Part of #9947, follow up from #10179
changelog_begin
changelog_end
* scalafmt
* Apply suggestions from code review
Co-authored-by: Remy <remy.haemmerle@daml.com>
* dont use case class for WarningLog
* revert TraceLog changes from last PR
* Scala 2.12 doesnt have ArrayBuffer.addOne :(
* remove isWarnEnabled check
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Warn on DA.Exception import
We had a few confused users that imported that module and got weird
errors. The warning should hopefully make things a bit clearer. We
could do this for other modules as well but I’ll leave that for
separate PRs.
changelog_begin
- [Daml Compiler] Importing DA.Exception on LF < 1.14 now produces a
warning that exceptions require Daml-LF >= 1.14.
changelog_end
* Add a test for exception imports
changelog_begin
changelog_end
* LF: Simplify archive reader.
- decouple Reader and Decoder
- introduce case class to handle hash, proto payload, and version
CHANGELOG_BEGIN
CHANGELOG_END
* Address Moritz' review
* cosmetic
We probably want to start displaying the full ptx on the client side
but for now this at least moves things out of speedy and into the
rendering layer where they belong.
It also fixes IncompleteTransaction to unwind properly so the roots
are really the roots.
changelog_begin
changelog_end
* Add divulgence warning and test in script service.
Part of #9947, building on the key visibility checks from #10136
This PR adds a divulgence warning inside the traceLog.
I wasn't sure whether:
1. these warnings should be kept in a separate structure from the
traceLog, and therefore transmitted separately, or
2. these warnings should be kept together with traces, but the severity
should be tracked and also transmitted over grpc, and warnings should
be logged as warnings instead of as debug messages, or
3. these warnings should be kept together with traces, but
logged as warnings instead of debug messages,
4. these warnings should be treated exactly like traces
I'm leaning toward #2, but this PR implements #3.
This PR tests the warning via the script service tests.
changelog_begin
changelog_end
* scalafmt
* Address Moritz's review
* Rename traceLog.add to traceLog.addDebug
* fix test
* Add test using exercise
* add single transaction test
changelog_begin
changelog_end
- DAML -> daml
- Assistant -> assistant
The capitalization of the latter fixed one occurrence of a capitalized 'A'
which was inconsistent with the vast majority of uncapitalized 'a's.
* Refactor error reporting in Daml Repl
fixes#10098
As mentioned in that issue, the current behavior is a mess which
silently drops errors in certain cases. This PR switches things around
so that errors are reported to the client and we print them there
making sure that no error should ever get lost.
changelog_begin
changelog_end
* Bump timeout
changelog_begin
changelog_end
* Run scenarios in off-ledger machine
This PR builds on the previous PR that split scenario execution in two
different speedy machines and now actually makes the machine that runs
scenarios run in off-ledger mode just like we handle Daml Script.
This required a bunch of refactoring to make it nice so apologies for
the slightly large PR. Hopefully it’s still relatively easy to follow
and luckily it deletes more code than it adds.
changelog_begin
changelog_end
* Apply suggestions from code review
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
* review comments
changelog_begin
changelog_end
Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
* Use ScenarioRunner.submit in Daml Script
changelog_begin
changelog_end
* privatize ledger variable
changelog_begin
changelog_end
* drop space
changelog_begin
changelog_end
* Split scenario & ledger execution
This PR by no means aims to solve everything we can do here. It is
rather the minimal change that I could get to work that provides us
with one Speedy machine for scenario execution (which is still an
on-ledger machine to avoid having to change the callsites to much in
this PR) and one speedy machine per submission.
There is tons of cleanup we can do afterwards but this should
hopefully set the right foundations.
changelog_begin
changelog_end
* Force css-what resolution in compiler/daml-extension & fully regenerate the lock file
changelog_begin
changelog_end
* Don't force resolution as it's unecessary
* Add proper error handling for missing contract keys
These are clearly not internal errors so we should not be calling
`crash` here. Canton in fact already started string matching on the
crash message which is definitely not what we want.
changelog_begin
changelog_end
* backwards compat
changelog_begin
changelog_end
* fix tests
changelog_begin
changelog_end
* Make data-deps exception tests version-aware.
This PR changes the exception data-dependencies tests to test cross-version imports of exceptions (once we release exceptions in preview).
It also removes the last exceptions TODO from the Haskell side, other than changing `featureMinVersion` for once we start releasing excepions.
Part of #8020
changelog_begin
changelog_end
* qualify everything
* typo
* Special case _tryCatch @Update in LFConversion.
This is in line with the special cases for (>>=), pure, etc
changelog_begin
changelog_end
* , args
* EUpdate
* Fix typeclass detection in data-dependencies
Fixes#9689 which was actually caused by misinterpreting a constraint
synonym as an empty typeclass.
This PR fixes and deduplicates the logic for detecting typeclass
definitions in data-dependencies. It also tries to avoid lifting
constraint tuples unnecessarily (since constraint synonym
definitions are already lifted). And for any constraint tuples
that are lifted, it picks a more unique name.
The PR adds a regression test, and a test for nested constraint tuples.
changelog_begin
changelog_end
* Preserve nice comment.
* Make succ/pred throw an ArithmeticError on overflow.
Part of #8020.
This is the only remaining case in daml-prim & daml-stdlib where it seems correct to me to throw a different exception type rather than `GeneralError`.
changelog_begin
changelog_end
* Fix Enum
* Make DA.Assert throw AssertionFailed instead of GeneralError
changelog_begin
- [Daml Standard Library] `assert`, `(===)`, and other assertion functions (see DA.Assert) now use a new `CanAssert` typeclass constraint instead of `CanAbort`, in preparation for exceptions support.
changelog_end
* Add CanAssert instances for Script and Trigger.
* buildifier-fix
* update script test runner output
* Fix flag and add tests.
* update script test runner again
* 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
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
The name of some builtins will be exposed as part of the Exception
message. This PR, try to make conversion builtins more consistent and
more obvious, before we could not rename those.
This is part of #8020
CHANGELOG_BEGIN
CHANGELOG_END
* 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
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
* 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
* 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
* Fix simplifier safety for AnyExceptionMessage
This highlights the danger of shifting definitions. At some point this safety was correct (AnyException contained the message string directly, "throw" took a message argument), and then we decided to have AnyException call a function associated with the type (to speed up exception throwing & catching), and this safety became incorrect :-(
changelog_begin
changelog_end
* s/may crash/may throw
The only thing `sanitize` does is mangle the names of identifiers and
types that end in `#`. That can't be a good thing. This PR removes
sanitize and enables MagicHash in data-dependencies, meaning names can
end in `#` without causing issues. (MagicHash also enables unboxed
literals, but that doesn't matter here.)
In practice, sanitize was only affecting `GHC.Prim.Void#`, which we
define because GHC sometimes references it. AFAIK there's no other
use of `#` in the standard library that we don't rewrite away.
changelog_begin
changelog_end
* 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
* 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.
* check whether collection.compat is unused when compiling for Scala 2.12
- Instead of always suppressing warnings for collection.compat._,
we should only do it for Scala 2.13
- We can also reduce boilerplate by automatically adding this
option when both silencer_plugin and collection-compat are
present
CHANGELOG_BEGIN
CHANGELOG_END
* remove unused import
* remove another unused import
* remove even more unused imports
* missed compat dependency
* more missed compat dependencies
* missed compat dependency
* use scala_deps in scaladoc_jar
- #8423 inlined the major version expansion, but this seems to
have been prior to proper support by scaladoc_jar
* restore custom handling of participant-integration-api
- fixing scaladoc_jar isn't worth it for a single case, as with
deps vs scala_deps
* 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
* 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!
* 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
While there might be nicer ways to do this, the current way is
consistent what we do for example with `create` which seems pretty
comparable and the check that `ty1` is an exception type happens in
the LF typechecker (again consistent with how we check for create that
the type is a template type) so this seems fine.
changelog_begin
changelog_end
As discussed, we don’t want to expose this via serializable values at
least for now (and it’s not exposed on the ledger API anyway) so this
PR drops the type.
changelog_begin
changelog_end
* 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>
* 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)
* 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
* Switch from `@silent` to `@nowarn`.
This annotation is native to Scala 2.12.13+ and 2.13.2+. It replaces
most usages of `@silent`.
I had to get creative about a couple of use cases that didn't work.
Specifically:
1. Suppressing deprecation warnings works, but Scala 2.12 erroneously
complains that the `@nowarn` is unnecessary. I had to suppress
this warning too with `-Ywarn-unused:-nowarn`.
2. I can't seem to suppress the warning, "The outer reference in this
type test cannot be checked at run time." Instead, I have
refactored the code to remove the warning.
We still need to use the silencer plugin to suppress some warnings about
unused imports (because of compatibility between Scala 2.12 and 2.13),
but this means we no longer need the library, and therefore it is not a
transitive dependency that downstream consumers need to worry about.
CHANGELOG_BEGIN
CHANGELOG_END
* Add some comments around `@nowarn` support.
* language-support/scala: Fix a warning suppression.
* Revert to the default warnings.
Compatibility was complaining.
* 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
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
* 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
* 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
* Add sqrt to DA.Math
fixes#9149
Not a huge fan of DA.Math but this seems like a nicer fix to #9149
than removing the lint.
changelog_begin
changelog_end
* revert change to lints
changelog_begin
changelog_end
* 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>
* Syntax highlighting for exceptions.
* Add `exception`, `try`, and `catch` as keywords.
* Add `throw` as function name.
changelog_begin
changelog_end
* Updated wrong language definition.
* Add 'message'
* 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
* 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>
* 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>
* Only walk list once in splitAt
No idea if that makes a significant difference anywhere but walking
the list twice is definitely not faster.
changelog_begin
changelog_end
* Avoid hardcoded locations in tests
changelog_begin
changelog_end
* Cleaning up BigNumeric somewhat.
Done in this PR:
- Moved BigNumeric and RoundingMode to GHC.Types to be alongside Numeric and Decimal
- Additive, Multiplicative, Number instances for BigNumeric
- Eq, Ord instances for BigNumeric and RoundingMode
Todo:
- BigNumeric literals in Daml
- Constructors and pattern matching for rounding mode
- Better documentation
changelog_begin
changelog_end
* remove ^ for now
* define (^) because it's required
* Error in (^) for negative powers.
* better error message
* import fromString and error
* Add -Wno-unused-imports because of compiling to different versions.
* add (fromString) and (error)
* Update bignumeric test.
* 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
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
Haven’t tracked down when they broke. They used to work at some point
but atm they are very broken and don’t test anything.
This PR fixes the bash mess to parse the files correctly and fixes two
minor issues that creeped in by virtue of the doctests being broken.
changelog_begin
changelog_end
* 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
Both of these seem sufficiently common that it seems worth optimizing
them.
I realize I’m switching somewhat randomly between foldr and
hand-written recursion. Either should be better than traversing the
list twice but I think it’s a clear sign that we need some benchmarks
to establish the benefits or downsides of one over the other properly.
changelog_begin
changelog_end
* New transaction node: NodeRollback. Fixup every match with a crash + TODO.
changelog_begin
changelog_end
* remove 3 methods from NodeRollback which are not needed to fulfill its interface
* add override to remaining 4 methods implemented in body of NodeRollback
* remove unrequired 2nd type parameter (Cid) from NodeRollback
* add missing 8020 marker
* 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
* 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
* 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
This PR addresses the TODO to expose the actual exception values and
type instead of the message. This allows us to simply speedy a bit by
removing the continuation used for that but more importantly it means
we can now catch and handle the exception in Daml script.
changelog_begin
changelog_end
This untangles the dependency structure a bit so that //daml-lf no
longer ends up depending on daml script and sandbox and similar crap
which should improve build times in general.
changelog_begin
changelog_end
* Add new variant to Value.scala for builtin-exceptions.
final case class ValueBuiltinException[+Cid](tag: String, value: Value[Cid]) extends Value[Cid]
And push through the code consequences.
Most places fixed up.
A couple more things to do in this PR (marked NICK)
A couple of things which can be left for later (marked 8020)
fix build
fix another scala match
changelog_begin
changelog_end
* fix any match
* add marker of code which needs attending to in the PR
* extend ledger-api value.proto & fix LfEngineToApi
* undo/comment-out the change to value.proto
* add tests in HashSpec for BuiltinException
* code but dont yet enable value-gen for builtin exceptions
* address comments which suggest we crash in various places
* support BuiltinException in scenario_service.proto
* one more TODO 8020 tag
* 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
This PR adds a hook in the compiler and the engine to allow easy prototyping of new features.
In particular by using this hook, one can add a new feature in 1.dev with modifying:
compiler
type checkers (both Haskell and Scala)
archive Protobuf
archive decoder
In addition of development speed, this also adds a bit of confidence, as the peaces enumerated above are not touched when adding the feature: The feature can be added by modifying only 1.dev Daml standard library and Speedy.
aa7991f8 shows a use case of this hook.
CHANGELOG_BEGIN
CHANGELOG_END
- 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
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
* 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
As a first step for the daml package manager, we move all dalf files
from (data-)dependencies to a new `.daml/dependencies` directory.
CHANGELOG_BEGIN
CHANGELOG_END
* 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
This PR adds stack traces to all ScriptF commands and handles those in
the converter. Those stack traces are not yet used. To ease review,
I’ve left that for a separate PR. The plan is to use this to tackle
https://github.com/digital-asset/daml/issues/8754.
changelog_begin
changelog_end
* 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
Pure shuffling around there is no logic change in here. I keep getting
lost in the 1.4k LedgerInteraction file so this client splits it up
into a 4 different files to make it a bit easier to navigate.
changelog_begin
changelog_end
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
* 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
* 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
CHANGELOG_BEGIN
- [LF] Release LF 1.12. This version reduce the size of transaction
- [Compiler]: Change the default LF output from 1.8 to 1.11.
CHANGELOG_END
Not perfect but probably much cleaner than what we had before. Some
of the orders can definitely be debated and I don’t have strong
feelings beyond the first 5 so if someone feels strongly, I’m open to
changing things.
New output:
Usage: damlc repl [DAR] [-i|--import PACKAGE]
[--ledger-host ARG --ledger-port ARG]
[--access-token-file TOKEN_PATH] [--application-id ARG]
[--tls] [--cacrt ARG] [--pem ARG --crt ARG]
[--max-inbound-message-size ARG]
[(-w|--wall-clock-time) | (-s|--static-time)]
[--project-root ARG] [--project-check]
[--include INCLUDE-PATH] [--package-db LOC-OF-PACKAGE-DB]
[--shake-profiling PROFILING-REPORT] [--jobs THREADS]
[--debug] [--ghc-option OPTION]
Launch the Daml REPL.
Available options:
-h,--help Show this help text
DAR DAR to load in the repl
-i,--import PACKAGE Import modules of these packages into the REPL
--ledger-host ARG Host of the ledger API
--ledger-port ARG Port of the ledger API
--access-token-file TOKEN_PATH
Path to the token-file for ledger authorization
--application-id ARG Application ID used for command submissions
--tls Enable TLS for the connection to the ledger. This is
implied if --cacrt, --pem or --crt are passed
--cacrt ARG The crt file to be used as the trusted root CA.
--pem ARG The pem file to be used as the private key in mutual
authentication.
--crt ARG The crt file to be used as the cert chain in mutual
authentication.
--max-inbound-message-size ARG
Optional max inbound message size in bytes.
-w,--wall-clock-time Use wall clock time (UTC). (this is the default)
-s,--static-time Use static time.
--project-root ARG Path to the root of a project containing daml.yaml.
You should prefer the DAML_PROJECT environment
variable over this option.See
https://docs.daml.com/tools/assistant.html#running-commands-outside-of-the-project-directory
for more details.
--project-check Check if running in Daml project.
--include INCLUDE-PATH Path to an additional source directory to be included
--package-db LOC-OF-PACKAGE-DB
use package database in the given location
--shake-profiling PROFILING-REPORT
Directory for Shake profiling reports
--jobs THREADS The number of threads to run in parallel. When -j is
not passed, 1 thread is used. If -j is passed, the
number of threads defaults to the number of
processors. Use --jobs=N to explicitely set the
number of threads to N. Note that the output is not
deterministic for > 1 job.
--debug Enable debug output
--ghc-option OPTION Options to pass to the underlying GHC
changelog_begin
changelog_end
* Ledger API test tool: test against legacy and preview version.
+ use dictionary instead of alias to map version keywords to LF version
CHANGELOG_BEGIN
CHANGELOG_END
improve previous generalization from #8695
- use lf version instead keyword (like 'stable', 'latest', 'dev') to
tag actual target. This will allow two keywords to map to the same
versions without doing twice the compilation/test work.
- use alias to map keywords tag target to versioned tag target.
- move package manage dar to test_commong.
CHANGELOG_BEGIN
CHANGELOG_END
* Draw the rest of the Scala 2.13 owl
Not quite but pretty close and this switches us over from inclusions
to exclusions which makes it much easier to track.
Ledger API test tool should be fixed by #8821. Non-repudiation needs a
tiny bit of work since unwrapArray doesn’t work the same on 2.13 but
shouldn’t be hard to fix.
changelog_begin
changelog_end
* Fix ScriptService tests
Those tests were all dumb. They asserted on a fixed order while the
function to sort the things was broken so we ended up with the random
Map order which is unsurprisingly not the same.
This is easily fixed by fixing the sort function.
There is also a second issue with query not sorting.
changelog_begin
changelog_end
* Turns out if you fix one test the next one breaks
And clearly nobody ever tested this or give this a second thought.
changelog_begin
changelog_end
* damlc: fix: catch UserError instead IOException
When the package-db metadata can not be parsed, an exception is thrown
and needs to be catched. Previously we were catching IOException, but
in this case it's actually a UserError that is thrown.
CHANGELOG_BEGIN
CHANGELOG_END
* damlc test: show full coverage report
We add a flag `show-coverage` to `damlc-test` to show templates that
are never created and choices that are never executed during the tests.
CHANGELOG_BEGIN
[damlc test] A new flag `show-coverage` shows full test coverage
reports.
CHANGELOG_END
changelog_begin
- [DLint] You can now disable dlint hints for a specific functions in
the form `{- DLINT ignore functionName "hintName" -}`, e.g.,
```
{- DLINT ignore noHint "Use concatMap" -}
noHint f xs = concat (map f xs)
```
Note: The undocumented {- HLINT -} pragmas are no longer supported.
changelog_end
* damlc: show test coverage
We add output to show percentage of created templates and executed
choices for `damlc test`.
This fixes#6370.
CHANGELOG_BEGIN
[damlc] Feature: Test coverage is reported for `damlc test`.
CHANGELOG_END
* added a test
* Update compiler/damlc/lib/DA/Cli/Damlc/Test.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* suggestions
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
This uses a "DamlException" tag to annotate which types should
be exported as exceptions. This tag will be added during the
desugaring of exceptions.
The code that scrapes for the HasMessage instance is based on the
corresponding template instance scraping code, but simplified since
we only have to pick up one instance. If we decide to pack more
information into the DefException structure in the future, we can
easily extend this.
This PR also adds a small test to make sure that a user-defined
exception is exported as such.
changelog_begin
changelog_end
We update ghcide, which enables cached goto definitions that keep
working when the document doesn't compile anymore. This also adds a test
to lsp-tests for this feature.
CHANGELOG_BEGIN
CHANGELOG_END
This is spun off from #7934 for ease of review.
For now, all of this is hidden (and for extra caution also marked as
early access). I expect we’ll tweak the API in a bunch of ways before
marking it stable but this at least is sufficient for the prototype.
At this point, we cannot support this over the JSON API. Not too
worried about that at least for now.
fixes#7847
changelog_begin
changelog_end
* DLint: Disable "Redundant pure" lint by default
When using `ApplicativeDo`, e.g. in Daml Scripts, a final pure might be
necessary although it would be redundant in a monadic context. This
leads to spurious warnings from the linter which I found quite
confusing.
CHANGELOG_BEGIN
CHANGELOG_END
* Adjust tests
CHANGELOG_BEGIN
CHANGELOG_END
This updates the daml-ghcide dependency and also adds a test to check
that we are not showing any internal symbols and dependencies in the
outline in daml studio.
CHANGELOG_BEGIN
CHANGELOG_END
We add a test to check that there are no internal imports returned by
the `getDocumentSymbols` endpoint for an empty module.
CHANGELOG_BEGIN
CHANGELOG_END
Fixes#8449
changelog_begin
- [DAML Standard Library] DA.Next.Map and DA.Next.Set are deprecated.
Please use DA.Map and DA.Set instead, or use DA.TextMap directly
for ledger API backward compatibility.
changelog_end
* Add --target=1.12 support in the compiler.
changelog_begin
- [DAML Compiler] Add support for ``--target=1.12`` in the DAML compiler.
changelog_end
* version1_12 not version1_11
* Update codegen tests.
* Update codegen tests again
* Fix data-dependencies test.
Disabling it per target works nicely for compilation but it gets
annoying in ghci since the warnings are still triggered. We could
disable it everywhere but I think the warning is generally useful. I
tried patching proto3-suite to use DerivingStrategies but that doesn’t
work because haskell-src is dead and doesn’t support it. So for now
adding it to the per-file list seems like the best option.
changelog_begin
changelog_end
* Add DA.Set to match DA.Map
Fixes#8448
changelog_begin
changelog_end
* Make it a stable package
* Add test.
* add map field
* fix stable-packages test
* update Examples.daml
* Add note about loglevel to trace and debug api doc
CHANGELOG_BEGIN
CHANGELOG_END
* Explain log level in comment of debug
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* fix typo
* propagate explanation to trace, traceId and debug
* Fix DA.Internal.Prelude location
changelog_begin
changelog_end
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* damlc: check for inconsistent dependencies
This fixes#8553.
We check that all dependencies have the expected LF version.
CHANGELOG_BEGIN
CHANGELOG_END
* move filter to guard
* turn mainUnitId lookup into set lookup
* Add choice observers in LF spec.
Part of #7709. Adds choice observers to the syntax, type system, and
and operational semantics of LF. Adds a test for the operational
semantics of choice observers.
changelog_begin
changelog_end
* typo
* remove duplicate rule
* Always have choice observers
* Add comment in serialization section
When I first wrote these tests I didn't realise you could have the `@ERROR` annotation anywhere in the file so I put them all near the top. This PR is just to move the `@ERROR` annotations closeer to where the error is generated, so it's easier to maintain. This is in preparation for updating the spec & tests for choice observers.
changelog_begin
changelog_end
* damlc: incremental package db initialization
We keep a hash over all dependencies of a project in the package
database metadata and only recompute the package database if a
dependency changes, i.e. the computed hash changes.
Fixes#4413.
Fixes#8409.
CHANGELOG_BEGIN
CHANGELOG_END
* using Fingerprint
* added tests
* format
* use SdkVersion instead of hardcoded version
* added a reference in tests
* factored out project file template
* telemetry: use an extra cache directory for telemetry
If the sdk's `.daml` directory is not writable, telemetry fails and
kills the IDE. We add a new assistant environment variable "DAML_CACHE".
If set, this directory is used for telemetry cache data.
Fixes#8396.
CHANGELOG_BEGIN
CHANGELOG_END
* try creating directory
* check for already existing machine id file
* set DAML_CACHE to read-only in assistant integration tests
Quoting @cocreature on Slack:
> the fact that --with-dlint is exposed as a public option at all seems
> broken. I don’t think it was ever intended to be one.
CHANGELOG_BEGIN
- [Daml CLI] Three options that were never meant to be public are now
hidden from the output of various `daml xxx --help` commands. The
options still have the same effect when present, so this is not (yet)
a breaking change. Using these options tends to result in very
unhelpful, when not outright broken, dlint configurations, so we expect
existing usage to be low to nonexistent. If you do use them please
share your use-case with us. The options are:
- `--with-dlint`
- `--without-dlint`
- `--allow-overrides`
CHANGELOG_END
* Remove redundant list of LF versions
After #8472, I realized that there must be a list used for daml-stdlib
and daml-prim already and it turns out there is. I’ve removed that one
in favor of the one added in #8472 since I like having all in one
place and the one from #8472 is created by filtering an existing list
instead of creating a completely separate list like we do here.
changelog_begin
changelog_end
* Introduce SCRIPT_LF_VERSIONS
changelog_begin
changelog_end
* Add the missing UTryCatch primitive.
I tested that the types are correct by uncommenting the corresponding
line in DA.Internal.Exception (which must remain commented, because
the engine does not yet support exceptions).
changelog_begin
changelog_end
* indent/associate
* typo :-(
* Add conversion for exception types
* Start adding exception primitives.
changelog_begin
changelog_end
* add more error message primitives
* Comment out the exception primitives for now.
* Dont use runtimeUnsupported
* Organize DA.Internal.Exception a bit.
* Add ActionThrow and ActionCatch.
* import all of DA.Internal.Prleude
* haskell brain
This PR updates scalafmt and enables trailingCommas =
multiple. Unfortunately, scalafmt broke the version field which means
we cannot fully preserve the rest of the config. I’ve made some
attempts to stay reasonably close to the original config but couldn’t
find an exact equivalent in a lot of cases. I don’t feel strongly
about any of the settings so happy to change them to something else.
As announced, this will be merged on Saturday to avoid too many conflicts.
changelog_begin
changelog_end
* Replace many occurrences of DAML with Daml
* Update docs logo
* A few more CLI occurrences
CHANGELOG_BEGIN
- Change DAML capitalization and docs logo
CHANGELOG_END
* Fix some over-eager replacements
* A few mor occurrences in md files
* Address comments in *.proto files
* Change case in comments and strings in .ts files
* Revert changes to frozen proto files
* Also revert LF 1.11
* Update get-daml.sh
* Update windows installer
* Include .py files
* Include comments in .daml files
* More instances in the assistant CLI
* some more help texts
* Port damlc dependencies to Scala 2.13
I got a bit fed up by the fact that going directory by directory
didn’t really work since there are two many interdependencies in
tests (e.g., client tests depend on sandbox, sandbox tests depend on
clients, engine tests depend on DARs which depend on damlc, …).
So before attempting to continue with the per-directory process, this
is a bruteforce approach to break a lot of those cycles by porting all
dependencies of damlc which includes client bindings (for DAML Script)
and Sandbox Classic (also for DAML Script).
If this is too annoying to review let me know and I’ll try to split it
up into a few chunks.
changelog_begin
changelog_end
* Update daml-lf/data/src/main/2.13/com/daml/lf/data/LawlessTraversals.scala
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
* fixup lawlesstraversal
changelog_begin
changelog_end
* less iterator more view
changelog_begin
changelog_end
* document safety of unsafeWrapArray
changelog_begin
changelog_end
Co-authored-by: Stephen Compall <stephen.compall@daml.com>
This only compiles `damlc-bootstrap` as a Haskell binary and `damlc` is
a simple symlink with additional runfiles.
We now need to define `damlc@ghci` manually since it is no longer
defined automatically. The manual definition was tested with
```
$ bazel run //:damlc@ghci --define ghci_data=True
> :main ide -d
```
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
Don't run the preprocessor on DA.Maybe since it doesn't need it, and the
preprocessor was generating a bunch of warnings due to use of the
PatternSynonyms extension. We can safely ignore these warnings.
Also refactors that part of the preprocessor a little bit.
changelog_begin
changelog_end
* Cut down data-dependencies test.
This PR reduces the data-dependencies test from quadratic to linear in the number of LF versions. It does so by only testing sequential version pairs, e.g. 1.6 to 1.7, 1.7 to 1.8, 1.8 to 1.11, 1.11 to 1.dev, and 1.dev to 1.dev. These pairs covers almost all potential problem.
changelog_begin
changelog_end
* add sort to scope
As we strive for more inclusiveness, we are becoming less comfortable
with historically-charged terms being used in our everyday work.
This is targeted for merge on Dec 26, _after_ the necessary
corresponding changes at both the GitHub and Azure Pipelines levels.
CHANGELOG_BEGIN
- DAML Connect development is now conducted from the `main` branch,
rather than the `master` one. If you had any dependency on the
digital-asset/daml repository, you will need to update this parameter.
CHANGELOG_END
* Update protobuf to throw exceptions directly.
Part of #8020. This PR changes the exception protobuf and AST (Haskell
side) to make exceptions be thrown directly via a primitive expression
(EThrow), instead of wrapping them up via AnyException.
changelog_begin
changelog_end
* Rename MakeAnyException to ToAnyException
* update EToAnyException field names
* Missing stuff
* missing scala case
* Make AnyException unserializable
* reindex protobuf builtins
* meaningless change
* refrobulate
* change pretty
* Make choice observers mandatory when available.
This is an invariant of the DAML-LF proto.
The haskell AST allows missing choice observers for any version, because the AST represents what was written in the syntax. However, if we are targeting a new DAML-LF version (>= `featureChoiceObservers`) then `Nothing` is converted to `Just (ENil TParty)` by the haskell encoder (`EncodeV1.hs`) to satisfy the proto invariant.
On the scala side, the decoder (`DecodeV1.scala`) now insists that choice observers are present when_ the version is new. (>= `LV.Features.choiceObservers`).
changelog_begin
changelog_end
* LF: LF encoder generate always choice observer if lf >= 1.dev (#8318)
This is a follow up of #8316.
This advances the state of #7709
CHANGELOG_BEGIN
CHANGELOG_END
Co-authored-by: Remy <remy.haemmerle@daml.com>
* damlc: Don't warn on ExplicitNamespaces extension
Since we allow the `TypeOperators` extension, which implies
`ExplicitNamespaces`, there is no point in warning in warning about
the latter.
There's not much to test for this wrt to `data-dependencies` since we
don't reconstruct export lists.
CHANGELOG_BEGIN
damlc: Don't warn on ExplicitNamespaces extensions anymore.
CHANGELOG_END
* Fix a test expecting a warning about ExplicitNamespaces
CHANGELOG_BEGIN
CHANGELOG_END
* Bundle hpp with damlc.
This PR eliminates the red squiggly lines you get when opening up the
standard library in daml studio (e.g. after a Go To Definitien).
(When CPP is used, Go To Definition is still pointing to the wrong place,
because the line numbers are messed up. But it's better than having a
million error messages.)
We could also remove --cpp flag in a separate PR, though that may be
considered a breaking change.
changelog_begin
changelog_end
* cleanup locateRunfiles jank
* Revert "cleanup locateRunfiles jank"
This reverts commit 82552003ae.
* damlc: warn on bad package names/versions.
This fixes#7208 and #7317. When package names or versions are
encountered in the daml.yaml that will be rejected by ghc-pkg when the
package is loaded as dependency, a big warning is output.
CHANGELOG_BEGIN
CHANGELOG_END
* hlint
* multiline strings
* update version regex
* update package name regex
* better error formatting regex printing
We drop the distinction (at the type level) of Dev and Stable language
version. The two main reason that motivate this choice:
* we never really used this distinction.
* we want to add the concept of "preview" version (which is neither Dev nor Stable)
CHANGELOG_BEGIN
CHANGELOG_END
At some point in time, `daml-licenses` was supposed to list the licenses
for all of our Haskell dependencies. It's not been updated in ages, and
we now have a reliable way to get at all our dependencies.
This is arguably a bit weird since the command is `daml damlc license`,
and it lists licenses for everything (`daml license` would make more
sense), but it seems a lot better to give a correst superset than an
incorrect list.
Perhaps we can move the command to `daml license` at some point, but I'd
see that as a separate step. (That would technically be a breaking
change, but I think this one might be OK.)
CHANGELOG_BEGIN
CHANGELOG_END
We used a weird mix of prettyprinting and string concatenation. This
breaks as soon as you have a line break somewhere because indentation
is messed up at that point. This PR fixes that by consistently (at
least more consistently than before) using the prettyprinting lib.
fixes#8213
changelog_begin
- [DAML REPL] Fix a bug where bindings with very long types sometimes
resulted in parse errors on following lines. See #8213
changelog_end
* update ghc-lib patch
* update stack-snapshot.yaml
changelog_begin
changelog_end
* bazel run @stackage-unpinned//:pin (on linux) and update stackage_snapshot.json
* testcase to check type signatures in template-lets are not ignored
* update to ghc-lib commit hash following merge
* update snapshot
* update snapshot after pin on windows
* update stack pin on linux
Co-authored-by: Nick Chapman <nchapman@digitalasset.com>
* Add DAML_EXCEPTIONS feature.
Part of #8020. This extracts the DAML_EXCEPTIONS feature from #8023
since we need it for typechecking & LF conversion soon.
changelog_begin
changelog_end
* add full url
* add another url
* Add exceptions in DAML-LF AST (Haskell side)
Updates the Haskell DAML-LF AST for exceptions, including
encode/decode, and updates all the functions that deal with the
AST directly.
changelog_begin
changelog_end
* Missed some TODOs in DecodeV1
* kvutils: Use ScalaPB to generate a Scala JAR for daml_kvutils.proto.
* Bazel: Delete the unused `da_java_binary` rule, and inline `_wrap_rule`.
* Bazel: Factor out Java/Scala protobuf class generation into a helper.
CHANGELOG_BEGIN
CHANGELOG_END
* daml-lf/archive: Use `proto_jars`.
* Bazel: Remove the visibility modifier from `proto_jars`.
It's too confusing. Just make everything public.
* daml-lf/archive: Push protobuf source tarballs into `proto_jars`.
* Bazel: Add comments to the various parts of `proto_jars`.
* daml-assistant: Do unpleasant things with `location` in Bazel.
Some features, in particular daml-lf encoding features, don't make any sense to have an associated CPP flag. I made the CPP flag optional and removed these unnecessary feature flags (based mostly on whether the flags were used in the standard library).
changelog_begin
changelog_end
* Adapt to new desugaring for choice observers.
update hash of ghc patch.
changelog_begin
changelog_end
update ghc patch to final version
update stack-snapshot hashes for ghc-lib(-parser)
update stackage_snapshot.json, following `bazel run @stackage-unpinned//:pin`
expose Optional constructors for desugared code to use
adapt LFConversion to expect a 4-tuple for a desugared choice def/sig
update LFConversion for choice-observers
first example using new choice observer syntax.
fix scala type checker to have correct scoping rules for choice-observers
remove comment from example which says it is broken
improve variable names
improve tests for choice-observer clause
only test choice-observers SINCE 1.dev
add jq queries for choice observeres
make positive statement in jq test which checks choice obserers are present
test behaviour of choice observers
squash me
typo
* test more choice-observer divulgence
* Update documention for choice observers.
changelog_begin
Support choice observers in 1.dev
changelog_end
* fix docs build
* fix daml docs choice-observers example
* address comments: rewording text
* annotate choices observers as early-access in documention
* split out documentation code-snippets which require --target=1.dev
* final tweaks to documentation text
* Rewrite multiple binding lets sequentially.
This PR enforces a sequential evaluation and dependency on
multiple-binding lets, by rewriting,
let x1 = e1
x2 = e2
...
xn = en
in b
Into a chain of single-binding let expressions,
let x1 = e1 in
let x2 = e2 in
...
let xn = en in
b
And likewise, rewriting multi-binding let statements in a "do" block,
do
...
let x1 = e1
x2 = e2
...
xn = en
...
Into single-binding let statements,
do
...
let x1 = e1
let x2 = e2
...
let xn = en
...
This PR fixes#6788 and adds a bunch of tests.
This is a bugfix, but it may break existing code that relies on
out-of-order let bindings. The suggested fix is to simply reorder
the let bindings, placing them in order of their dependency.
CHANGELOG_BEGIN
- [DAML Compiler] The DAML compiler now enforces sequential
ordering for ``let`` expressions with multiple bindings.
This fixes a bug where ``let`` expressions would be evaluated
in the wrong order.
CHANGELOG_END
* Update compiler/damlc/daml-preprocessor/src/DA/Daml/Preprocessor.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* adjust last binding behavior
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* DAML-LF: Add interning for type to DAML-LF 1.dev
We add two new features to DAML-LF 1.dev:
* a per package list (or table) of `Type` messages, and
* a new case in the `Type` message which is an index into this table.
In combination, these two features can be used to allow DAML-LF
encoders to perform hash-consing of `Type` messages. We also change the
Haskell implementation of our DAML-LF encoder to do exactly that when
targetting DAML-LF 1.dev.
Doing this has a few benefits:
1. The DALFs produced by `damlc` get smaller: I've seen a case where
the size dropped from 69MB to 45MB.
2. DAML-LF decoders need to decode less data.
3. Decoded packages use less memory because identical structures are
now shared. This is particularly helpful in situations where we need
to keep the interface (or signature) of a package in memory for a
long time.
This PR mostly takes care of the Haskell implementation. However, we
need to make the Scala implementation of the decoder aware of the new
features as well since we have tests that load DAML-LF 1.dev into the
engine. A decoder and _targeted_ tests on the Scala side will follow
in a separate PR.
CHANGELOG_BEGIN
CHANGELOG_END
* Make jq tests aware of type interning
CHANGELOG_BEGIN
CHANGELOG_END
* Improve jq test
CHANGELOG_BEGIN
CHANGELOG_END
* Apply Remy's suggestions
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Improve the imperative bits
CHANGELOG_BEGIN
CHANGELOG_END
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Make GHC recognise our ($) operator.
Fixes#4555 by moving ($) to GHC.Base and giving it a levity polymorphic
signature, as GHC expects. Added a regression test.
changelog_begin
changelog_end
* Update line numbers for debug...
* Fix `daml test-script` tests
changelog_begin
changelog_end
* fmt for the format gods
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>