With this change, Daml exerciseByKey use the LF primitive
ExerciseByKey instead of the combinason of FetchByKey + Exercise.
CHANGELOG_BEGIN
CHANGELOG_END
The functions are available through typeclasses / typeclass instances
generated during desugaring. Moved the test over to use these, and
discovered a bug in our implementation of `observer`.
changelog_begin
changelog_end
The upgrade to node-fetch 3.x broke our vscode extension because it
can only be loaded from proper ES modules. I tried changing our
tsconfig to emit that but I couldn’t figure out how to make vscode be
happy with an es module extension. So in the end I gave up and stuck
with commonjs and downgraded to node-fetch 2.x which is still in
maintenance mode and gets bugfixes for now.
However that resulted in me finding a bunch of other issues: The
upgrade to new LSP versions resulted in our LSP server crashing on
messages sent by the vscode extension. So I had to upgrade the client
libraries as well to fix that which required upgrading typescript
as well as @types/vscode which forces a bump of the minimum vscode
version. 1.52.0 is from November 2020 so not that concerned but I’ll
let product know in case theyre worried.
With this change things now work correctly and the extension is
backwards compatible with SDK 1.18.0 which matches our usual approach
of trying to get users to install the latest version of the extension.
changelog_begin
- [Daml Studio] The minimum supported vscode version is now 1.52.0.
changelog_end
* Upgrade ghcide
Spun out from the GHC 9 upgrade to make it easier to review. All
credit goes to Moisés.
changelog_begin
changelog_end
* .
changelog_begin
changelog_end
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
* damlc: Don't rely on polymorphic constant worker
Fixes https://github.com/digital-asset/daml/issues/12166 which was
caused by assuming that GHC would create a "worker function" for
all constructors. GHC doesn't create one if the constructor takes
no arguments. This only caused a problem with partially applied
constructors, so, it only applies to zero argument constructors of
polymorphic types in situations where the type argument is eta-reduced.
changelog_begin
changelog_end
* rename the test file
* Update compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
I got unreasonably confused why we sometimes pass `Nothing` here and
why the templates are sometimes unused so this PR attempts to clarify
this a bit.
changelog_begin
changelog_end
Since Scala 2.13.2, Scala introduced built-in support to
manage warnings in a more granular fashion, thus making
the silencer plugin we are currently using no longer
strictly useful. Removing compiler plugins also removes
friction from migrating to Scala 3 in the future. As a
cherry on top, the built-in warning configuration also
allows to check whether a `@nowarn` actually does
anything, allowing us to proactively remove unused
warnings should the need arise.
[Here][1] is s a blog post by the Scala team about it.
Warnings have been either solved or preserved if useful,
trying to minimize the scope (keeping it at the single
expression scope if possible). In particular, all
remaining usages of the Scala Collection API compatibility
module have been removed.
Using the silencer plugin also apparently hid a few
remaining usages of compatibility libraries that were used
as part of the transition from Scala 2.12 to Scala 2.13
that are no longer needed. Removing those warnings
highlighted those.
changelog_begin
changelog_end
[1]: https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
* Make UserId properly opaque by defining it as a variant instead of as a record.
changelog_begin
changelog_end
* hand coded Show instance for UserId
* rename: userName --> userIdToText
* Add missing serializability checks for interfaces
The checks for argument & result type were missing before. I openey
https://github.com/digital-asset/daml/issues/12482 to do the same fix
on the Scala side.
fixes#12475
changelog_begin
changelog_end
* .
changelog_begin
changelog_end
* Remove user-management error cases from scenario-service proto.
changelog_begin
changelog_end
* remove Error.UserManagement
* remove UserManagememtError
* simp
* meh... done over by scala's poor excuse for a type system
* Error handling for User Management exposed via daml-script
changelog_begin
changelog_end
adapt ScriptTest.daml to new user-management interface
adapt create-daml-app Setup.daml to new user-management interface
* Add deriving Ord for UserId
* change example of invalid user-id char to "%" from "." (which is no longer illegal)
* recover/reify ALREADY_EXISTS from GrpcLedgerClient.createuser
* fix testcase expected order of users from daml-script listUsers
* adapt create-saml-app Setup.daml to changed interface of user-management
* reinstate sort lost in merge
* sort user in ScriptService user-management test
* improve comment for error foobar hack
* improve doc comment for validateUserId
* use upper case as test example for invalid user-id
This upgrades vsce to the latest version and also markdown-it which is
unfortunately still pinned to an older version with a vulnerability.
There are some minor changes required to our invocations of vsce. I
tried to test this locally up to the point where it fails due to me
not having a token. We’ll only fully see it working after the next
stable release unfortunately.
changelog_begin
changelog_end
* Add timeouts to polling funcs in daml start.
This PR adds timeouts to some polling functions used in daml start and
the assistant integration tests, and also early exits based on a process
exit status. E.g. waitForHttpServer will make sure some process is
still running, instead of waiting to timeout.
The effect of this is that now whenever there is some error in a
subprocess, daml start and the integration tests will finish early
instead of running forever (or timing out in bazel).
changelog_begin
changelog_end
* missing a readPortFile instance
* Clarify unhandled exception error message
The previous error doesn’t make it clear that this is an exception in
user code rather than a Scala exception in our code.
Daml-lf exception would technically be more correct but I don’t think
it’s helpful here so I went with Daml exception.
changelog_begin
changelog_end
* adjust ledger api test tool
changelog_begin
changelog_end
* Update test assertions
changelog_begin
changelog_end
* fix another assertion
changelog_begin
changelog_end
Somewhat error-prone, so please review carefully.
Reasons we need this:
- Some file types are not properly handled by the script.
- The only exclusion mechanism we currently have (`NO_AUTO_COPYRIGHT`)
is overly coarse.
CHANGELOG_BEGIN
CHANGELOG_END
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.
I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.
CHANGELOG_BEGIN
CHANGELOG_END
* Set --enable-scenarios to False by default
changelog_begin
changelog_end
* Enable scenarios for shake test
* Add --enable-scenarios=yes for //compiler/lsp-tests
* Add enable_scenarios arg to rules_daml/daml.bzl helpers
* daml_compile
* daml_build_test
* daml_test
* Add enable_scenarios to ledger/test-common helper da_scala_dar_resources_library
* Add --enable-scenarios=yes for //ledger/test-common
* Remove unused scenario in //ledger/test-common PingPong test
* Add --enable-scenarios=yes for //daml-lf/tests
* Add --enable-scenarios=yes for //language-support/java tests
* Add --enable-scenarios=yes for group-chat example
* Add --enable-scenarios for //ledger/sandbox-perf LargeTransaction test
* Add --enable-scenarios=yes for //docs tests
* Add --enable-scenarios=yes for //daml-lf/scenario-interpreter tests
* format bazel
* Add --enable-scenario=yes for 'daml_doc_test's
* Add --enable-scenarios=yes for DamlDocTestIntegration
* Add --enable-scenarios=yes for DamlcTest
* Add --enable-scenarios=yes for Test/DataDependencies
* Add --enable-scenarios=yes for daml-ghc-deterministic.sh
* Add --enable-scenarios=yes for Test.IncrementalBuilds
* Add --enable-scenarios=yes for tests:memory-bond-trading and tests:memory-examples
* Add --enable-scenarios=yes for daml-assistant/integratio-tests
I keep confusing myself because of this and I expect I’m not the only
one. We have this for forM already so this only seems natural.
The definition is in DA.Foldable rather than DA.Internal.Compatible
since it doesn’t make sense to have it imported when you don’t import forA_.
changelog_begin
changelog_end
We erase the call to `mkMethod` in `convertExpr` instead of pattern
matching against the binding. This fixes a bug when the method body
contained statements using typeclass dictionaries such as
`do [2] === [2]`.
CHANGELOG_BEGIN
CHANGELOG_END
* Add --enable-scenarios hidden flag
* Fail LFConversion when a scenario is defined and --enable-scenarios=no
* Remove unused optIsGenerated=True test cases
* Refactor getIntegrationTests
* Add no-scenarios-enabled tests
* Add enable-scenarios flag to scenario-service server
* Add test ensuring that scenario-returning functions are still allowed
* Remove 'enable scripts' option (--daml-script)
* Add --scripts synonym to --scenarios
* Rephrase scenarios flags descriptions
changelog_begin
changelog_end
Previously, it was only applied for messages towards the script
service but not for messages towards the Haskell client. Now we
increase the max size in both directions.
See
https://discuss.daml.com/t/increase-max-message-size-in-daml-studio/3573/9
for the forum thread that raised this.
changelog_begin
- [Daml Studio/Daml Test] The `grpc-max-message-size` field in
`daml.yaml` now also applies to the message that contains the result
of a script.
changelog_end
* Drop damlc code for LF <= 1.11
Still a tiny bit left for pre 1.14 but this covers most of it.
changelog_begin
changelog_end
* delete numeric equal prmitives
changelog_begin
changelog_end
* daml-docs: Refactor context type.
Also remove context and args from templates, since that was
only needed with generic templates v1.
changelog_begin
changelog_end
* fix tests
* Drop non-type synonym code from LF conversion
We stopped emitting LF < 1.8, this is unused and untested at this
point.
changelog_begin
changelog_end
* drop parameter from mkDictProj
changelog_begin
changelog_end
* Update compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
* Update TODOs to outdated issues.
In particular update a lot of defunct interface TODOs to the LF 1.15
issue (or add the LF 1.15 issue if it's also relevant).
changelog_begin
changelog_end
* typo
* remove numeric/bignumeric todo
* scalafmt!!
* drop choice observer TODO
* interfaces: Prevent circular and non-closed reqs
Updates the haskell side to be more strict about requirements:
- requirements must be transitively closed, so if A requires B, and B requires C,
then A requires C.
- no circular requirements allowed
The logic for circular requirements is a bit duplicated to get a better
error message.
Part of https://github.com/digital-asset/daml/issues/11978
changelog_begin
changelog_end
* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/Check.hs
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* take a list in NotClosed error
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
The problem with envEmptyInterfaces is that it can only detect
interfaces in the current module. When you try to implement an
interface across a module boundary, LFConversion has very little
information about the interface.
This PR removes envEmptyInterfaces and simplifies the code
that used it, so it works uniformly for all interfaces
regardless of how many methods it has. The alternative would be
to pass more information into LFConversion, but this seems simpler.
changelog_begin
changelog_end
This adds a couple of doc strings to interfaces to test that they are
properly extracted and shown in the generated documentation.
CHANGELOG_BEGIN
CHANGELOG_END
* interfaces: Add "requires" field in Haskell AST.
Part of #11978. Adds typechecking for this on the interface and
implementation side.
changelog_begin
changelog_end
* Fix all the errors
* Move toInterfaceContractId and fromInterfaceContractId out of Implements class
* Split Implements class into single-method classes
* Define toInterface outside its class to swap type arguments
This allows users to call 'toInterface @Interface', since the type of the template can usually be inferred
* Move interface classes and functions to DA.Internal.Interface
changelog_begin
changelog_end
* Mark lsp tests as flaky
Not quite sure what is going wrong and doesn’t seem worth prioritizing
right now so marking them flaky again (they were marked flaky until a
few weeks ago).
changelog_begin
changelog_end
* .
changelog_begin
changelog_end
This is part of #11691
This PR allows to limits:
- the number of signatories,
- the number of observers,
- the number of controllers,
- the number of inputContracts,
CHANGELOG_BEGIN
CHANGELOG_END
* docs: support for interface implementations
This produces documentation for interface implementations of templates.
CHANGELOG_BEGIN
CHANGELOG_END
* Update compiler/damlc/daml-doc/src/DA/Daml/Doc/Render/Output.hs
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
* add check for modulename for implementations
CHANGELOG_BEGIN
CHANGELOG_END
* added golden tests to daml-test-files
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
I noticed we didn't have a "subset" function in DA.Set when Oliver
showed me some daml test code that had to define it manually. So I
decided to add it, and a couple more predicates.
changelog_begin
changelog_end
Closes#11317
* Add warning for uses of 'controller ... can' syntax
* Remove uses of 'controller ... can' syntax
* Add test cases for -W{,no-}controller-can
* Update docs to reflect 'controller ... can' syntax deprecation
changelog_begin
* Deprecate 'controller ... can' syntax.
* It will be removed in a future version of Daml.
* Instead, use 'choice ... with ... controller' syntax. Note that this does not implictly add the controller as an observer, so it must be added explictly as one (or as a signatory).
changelog_end
This PR enforces that forbidPartyLiterals is always `true` and drops
the corresponding literals from the AST in our Haskell code. Scala
code will follow separately.
part of #11581
changelog_begin
changelog_end
Currently the validation only allows for 3-component version
names. However even our own releases don’t respect that for snapshots
so instead we relax the validation to allow an arbitrary number of
numeric components which matches what ghc-pkg allows.
changelog_begin
changelog_end
* Limit supported input versions in damlc to >= LF 1.8
1.8 was the version that introduced type synonyms, we really don’t
gain much by dropping more since data-dependencies mainly depends on
that. and this provides for a very natural upgrade path for users
where pretty much everyone should be able to upgrade directly to SDK
2.0 without having to go through intermediate versions.
changelog_begin
- [Daml Compiler] The supported input LF versions for
data-dependencies are now limited to LF 1.8 and newer.
changelog_end
* fix some tests
changelog_begin
changelog_end
* Drop export 1.6 tests
changelog_begin
changelog_end
* Drop daml2js support for LF < 1.8
changelog_begin
- [Daml2js] DARs with LF version < 1.8 are no longer supported.
changelog_end
* .
changelog_begin
changelog_end
* bash is bad, stop using it
changelog_begin
changelog_end
* .
changelog_begin
changelog_end
* Add type rep argument for interface exercises.
(Still WIP.)
Part of #11703. Fixes the order in which errors are raised ("wrong type"
takes priority over "does not implement interface"). This PR also simplifies
ExerciseInterface by making the guard mandatory, otherwise there's too
many variations. We can revisit that later if we want.
changelog_begin
changelog_end
* haskell side
* dont throw exception in checkTemplateId
* scalafmt
* evidence security
* fix TypingSpec test
* Split daml-lf encode/decode Haskell libraries
I was working on limiting the supported input versions in damlc. This
requires the list of stable package ids so we can allow those to be
decoded even if they are older.
However that leads to a cyclical dependency:
To get the package ids of the stable packages, I need to encode
them. The version check is in the decoder. If those live in the same
package, I now end up with a cyclical dependency and
Bazel (understandably) gets very sad.
This PR splits decoding/encoding into two libraries with the
generation of stable packages only depending on encoding.
changelog_begin
changelog_end
* Fix dependants
changelog_begin
changelog_end
* Make DA.List.Total return Optional instead.
Instead of using ActionFail or CanAbort, return an Optional. The library
user can then convert this into the appropriate error if they wish.
This PR also removes DA.Optional.Total (and the deprecated DA.Maybe.Total)
for having questionable utility.
changelog_begin
- [Daml Standard Library] DA.List.Total functions now return Optional
instead of being polymorphic in the return type. DA.Optional.Total
has been removed.
changelog_end
* update Examples.daml
* Drop DA.Next.Set and DA.Next.Map
Fixes#11527. Also removed a bunch of unnecessary CPP, though there's
still a lot more CPP to remove.
changelog_begin
- [Daml Standard Library] DA.Next.Map and DA.Next.Set have been removed
after being deprecated since Daml-LF 1.11
changelog_end
* Drop a deriving MapKey
* update unstable-types test
* Add a guard when exercising by interface.
This fixes part of #11703, when exercising an inherited choice by
interface and you know the template id, via the command preprocessor.
It does this by inserting a "guard" in between the interface fetch and
the exercise body. The guard is a function Interface -> Bool, which
is general enough to check the template id, without complicating too
much in speedy. And can be generalized in the future to check more,
like signatories, etc.
I added the guard as an optional argument to UExerciseByInterface.
This isn't hooked up to the protobuf AST yet (or Haskell side for
that matter) -- but I'll do it in the next PR! For now you can invoke
the guarded exercise via the command preprocessor, so I can enable the
approprate engine tests. (There's still some failing fetch tests left,
but I decided to leave this for later. Fetch can be a lot simpler than
guarded choices, since you always add a fetch node. No need for fancy
continuations.)
changelog_begin
changelog_end
* scalafmt
* Feedback and fix matches
* Update comments, we are always going to abort the transaction
* Raise WronglyTypedContract in SBGuardTemplateId.
* rebase and fix parser
* restore ANF
* scalafmt
* Drop LF < 1.14 from supported damlc output versions
fixes#11319
We keep test coverage by depending on the most recent snapshot which
still has 1.14 support.
changelog_begin
- [Daml Compiler] Damlc can only produce Daml-LF 1.14 or
newer. Passing aynthing older to `--target` is an error. If you
need to produce older versions, use an older SDK.
changelog_end
* Switch around legacy_compiler_lf_versions
changelog_begin
changelog_end
* drop since-lf
changelog_begin
changelog_end
* [Self-service error codes] Enabled by default
* Flag changed to `use-pre-1.18-error-codes` (disabled by default)
CHANGELOG_BEGIN
[Ledger API Specification] The Ledger API returns enriched error codes (see https://docs.daml.com/error-codes/self-service/index.html)
For backwards-compatibility, a new API flag `--use-pre-1.18-error-codes` is introduced for preserving the legacy behavior for
clients that want to migrate incrementally to the changed gRPC status code responses and error details format.
CHANGELOG_END
* Adapted HttpServiceIntegrationTest
* Renamed `Feature Flag` to `Configuration` in docs
* Fix Daml Script tests
changelog_begin
changelog_end
* Fix Repl functests
changelog_begin
changelog_end
* Fix haskell binding tests
changelog_begin
changelog_end
* Fix CommandClientIT test
* Fixed Sandbox and CommandServiceBackpressureIT tests
Please enter the commit message for your changes. Lines starting
* Adapt //compiler/damlc/tests:repl-functests again
* Fix more tests and address Miklos' comments
* Flag name changed to `grpc-status-codes-compatibility-mode`
* Remove useless flags sandbox-classic
* Sandbox-classic tests fix for ContractKeysIT and ExceptionsIT
* Created 2 deprecated test suites that have the more generic assertions as returned
by the deprecated in-memory backend
* More fixes for CommandServiceIT
* Fixes compilation issue with the deprecated exceptionsIT class for Sandbox-classic in-memory
* Compatibility mode for old test tools
* Change flag name to `use-pre-1.18-error-codes`
* Apply suggestions from code review
Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
- rename non-default builders `apply` to `build`
* avoid confusing both
* make explicit the build can crash
- make interfaceId and templateId fields consitent
- use when possible named arguments
- check for non-repetition of inherited choices
CHANGELOG_BEGIN
CHANGELOG_END
* Update ghc patch
* Replace Implements proxy datatype with a class
* Expose 'Implements' class in Prelude
* Add DA.Internal.Desugar.HasMethod class
This allows us to get the type of a method of an interface through the functional dependency
* Convert interfaces from new desugaring
* Update Interface daml-test-file to use Interface class functions
* Update InterfaceDesugared daml-test-file
* Replace remaining uses of Is<Interface> methods with Implements
* Document HasMethod, Method and mkMethod
* Ignore _method_ bindings in convertBind
* Ignore interface desugaring types/classes/instances/functions in LF conversion
* update snapshot after pin on windows
changelog_begin
changelog_end
* Update to Java 11
changelog_begin
changelog_end
* Fix RoundingMode deprecation warnings
* Fix dep-ann warning
* Integer constructor
* JavaX annotation dependency
* javax.xml.bind was removed in Java 11
Using Guava as a replacement, since it is already a project dependency.
* JDK 11 no longer has a separate JRE tree
* Remove unused jdk_nix import
* remove now redundant jdk11_nix
* Java 8 --> 9 increased Instant.now() precision
See https://bugs.openjdk.java.net/browse/JDK-8068730
The precision of `Instant.now()` increased between Java 8 and Java 9.
On Linux and MacOS this doesn't seem to be a problem, as the precision
still seems to be at micro seconds. However, on Windows this now causes
errors of the following form:
```
java.lang.IllegalArgumentException: Conversion of Instant
2021-11-05T13:58:56.726875100Z to microsecond granularity would result
in loss of precision.
```
Suggesting that it now offers sub-microsecond precision.
`TimestampConversion.instantToMicros` had a check to fail if the
conversion lead to a loss of precision. In the specific failing test
case this is not a concern, so this adds a `roundInstantToMicros`
variant that avoids this kind of error.
* TMP round timestamps
* Revert "TMP round timestamps"
This reverts commit af8e261278.
* Skip versions before 1.6.0 in migration tests
changelog_begin
changelog_end
Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
I’ve kept the infrastructure for versioned_scala_deps around because
I’m optimistic and hope that eventually we’ll do another Scala upgrade.
changelog_begin
changelog_end
This seems like a more sensible default. There are really only very
few places where it makes sense to do things automagically (mainly the
IDE). For everything else we might just end up wasting time by
compiling stuff we don’t need.
changelog_begin
changelog_end
* interfaces: Preserve by_interface data for create.
Part of #10915
This was a lot more involved than fetch or exercise. The first issue is
that we need to preserve the interface id into speedy, so it needs a
separate primitive ("experimental" won't cut it). Second, because
speedy's create requires the template definition, and now the interface
id as well, we basically need to compile a separate version of "create"
for each interface that a template implements, hence the separate
`CreateByInterfaceDefRef(templateId, ifaceId)`.
changelog_begin
changelog_end
* scalafmt and refactoring
* fixx merge conflict
* fix silly mistakes
* Refactor speedy to distinuish SExpr types before/after ANF compilation phase
CHANGELOG_BEGIN
CHANGELOG_END
* remove commment/marker left in error
* make SExpr0 private to speedy
* reinstate (non-pp) print of original expression in AnfTest faiure
* avoid use of s./t. prefixes for expressions in SBuiltin; add 3 TODO markers
* inline "runtime" apply methods of SDefinitionRef into sole caller: SBCallInterface
* avoid use of t. prefix in SExpr0
* change s./t. prefix to source./target.
* add comment to summarize differences between SExpr0 and SExpr
Following up #10827 and #10921, we drop type parameter to
KeyWithMaintainers, and use the `Versioned` wrapper introduced in
CHANGELOG_BEGIN
CHANGELOG_END