Not really significant but seems better to be on the safe side and
keep this consistent with isDuplicate than try to do something
different here.
changelog_begin
changelog_end
This speeds up data-deps generation from ~30s to < 10s. It’s not quite
where we could be (9s vs 6-7s) but given that this is much simpler
than trying to make alpha equivalence expand lazy and we have more
options for speeding this up so this seems good enough.
changelog_begin
changelog_end
* interfaces: lf conversion of preconditions
This adds the LF conversion of preconditions from the desugared GHC code
to Daml LF for preconditions. This depends on the corresponding patch of
the GHC fork.
CHANGELOG_BEGIN
CHANGELOG_END
* pin linux stackage snapshot
* added a test
CHANGELOG_BEGIN
CHANGELOG_END
* pinned linux stackage snapshot
CHANGELOG_BEGIN
CHANGELOG_END
* additional InterfacePrecondition test
this checks that that conjunction of all preconditions of intererfaces
and templates is checked.
CHANGELOG_BEGIN
CHANGELOG_END
* pin stackage snapshot
* pin windows stackage snapshot
* update compile.yml (again)
* pin linux stack snapshot
* fix InterfacePrecondition test
* pin windows stackage
* Remove virtual choices
* Remove choices without a body in 'interface' definition
* Remove choices in 'template ... implements' section
part of #11372
changelog_begin
changelog_end
* Remove virtual choices cont.
Switch uses of virtual choices to fixed choice with method implementation
* update snapshot after pin on windows
* Disable failing interface tests with TODO #10810
We only need the package id which only requires decoding the header
which is exactly what decodearchivePackageId exists for.
On a large project this seems like a 10-20s improvement which is
pretty significant.
changelog_begin
changelog_end
Also drops the weird Base module and the always empty tags (yet
another reason why I want to burn our own logging lib with fire).
changelog_begin
changelog_end
* iface: check for interface implementations precond
We change speedy to also check all preconditions defined in interface
implementations upon a create.
CHANGELOG_BEGIN
CHANGELOG_END
* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
* format
* interfaces: lfconversion for iface preconditions
This adds interface preconditions to the interface implementations
during completion phase in the LF conversion.
CHANGELOG_BEGIN
CHANGELOG_END
* format
* rebase
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Pass `damlc build` logs through daml logger
This gives us some timings which can be useful in some
circumstances (I want timings around data-dependencies next).
I also changed the default log level to INFO. The `damlc build` output
doesn’t get any noisier from that.
Example output:
```
2021-11-01 15:25:17.16 [INFO] [build] []
Compiling foobar to a DAR.
2021-11-01 15:25:17.80 [INFO] [build] []
Created .daml/dist/foobar-0.0.1.dar
```
changelog_begin
changelog_end
* Adjust scenario service log level
changelog_begin
changelog_end
* Adjust tests
changelog_begin
changelog_end
* delete comment
changelog_begin
changelog_end
* Check fixed choices in name collision checker
This is a follow up to #11364. This PR checks that the list of inherited
choice names is correct in the type checker, and moves the "fixed choice name
collision" check into the name collision checker using this data.
Haskell side only for now. Part of #11137.
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>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* interfaces: precondition, scala ast, decoder/encoder
This adds the interface precondition to the scala Daml LF AST, plus
decoder/encoder and the typechecker.
CHANGELOG_BEGIN
CHANGELOG_END
* Update daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
* format
Co-authored-by: Remy <remy.haemmerle@daml.com>
* ifaces: update ghc-parser
This updates the ghc-parser, including the `ifaceTypeRep` method
generation for interfaces.
CHANGELOG_BEGIN
CHANGELOG_END
* pin stack snapshot on unix
* add tests
* update ghc-lib hash
* pin stackage dependencies on unix
* pinned stackage windows
* Add DA.Internal.NatSyn as a stable package
This module exposes a type NatSyn, to be used for encoding
type synonyms of Nat-kinded types
* Add generalized roundtrip test helpers in LFConversion tests
roundtripTestsBy and roundtripTestsPartialBy are like their
non-By versions, except they take an explicit equality predicate
instead of relying on the Eq instance. This allows the source
and target types to differ.
* Define encoder/decoder for type synonyms
This works by saturating the RHS of the declaration with artificial
variable names and adding the corresponding parameters on the LHS
In the case of Nat type synonyms, the Proxy-like
DA.Internal.NatSyn.NatSyn type is used to wrap the value into
something of kind star.
* Use type synonym encoder/decoder when generating/consuming DALF
This closes#11226
changelog_begin
changelog_end
* Extend type synonyms over data-dependencies test
* Add test cases for multi-param type class synonyms
This adds an experimental `toTypeRep: forall t. t -> TypeRep` builtin.
It will only work on interface payloads and crash horribly otherwise.
CHANGELOG_BEGIN
CHANGELOG_END
We’ve seen the tests time out despite already having a 900s test
timeout so this PR speeds up the tests using the following approaches:
1. Drop redundant test. We don’t need a test to test that daml repl
starts without a ledger if other tests also use that. Admittedly that
could make debugging slightly worse but I’m happy to accept that here.
2. Stop using a Ledger where we don’t need one. The import tests are
about testing the client side not the server side.
3. Share ledgers where we can. The inbound messages size tests and the
static time tests can reuse the ledger.
4. Stop using packages where we don’t need them. This speeds up both
ledger startup as well as Daml Repl startup.
changelog_begin
changelog_end
* interfaces: Add fixed choice name collision check
Add a check that a template cannot have two choices with the same name,
even taking into account all of its "inherited" interface fixed choices.
Part of #11137
changelog_begin
changelog_end
* "Me want" -> "We want"
* Add 'fsFromText' helper function in UtilGHC
* Define exports encoding/decoding
* Test exports encoding/decoding
* Tweak convertQualified to take a function on Name
* Generate $exports value
This includes all the values exposed by the module.
* Add norm_exports jq filter for QUERY-LF tests
* Test $exports value generation
* DataDeps reconstructs exports from $exports value
* Test data-dependencies preserves cross-package exports
* Only emit $exports entries for values defined in other modules
* Only emit $exports entries for Daml-LF versions that support type synonyms
* Do not emit $exports entries for internal DAML modules
* Use one $export<i> value per exported entity
changelog_begin
changelog_end
changelog_begin
- [Daml Stdlib] Add `debugRaw` as a convenience wrapper around
`traceRaw` when used inside a do-block. `debugRaw` compares to
`debug` like `traceRaw` compares to `trace` meaning it expects a
`Text` instead of calling `show` on an expression.
changelog_end
* Extract UtilGHC module from daml-lf-conversion to its own library
* Drop daml-preprocessor dependency on daml-lf-conversion
changelog_begin
changelog_end
* interfaces: Do some TODOs
- Add uniqueness check between fixed choices and virtual choices in
haskell decoder.
- Encode interface methods and fixed choices in scala encoder.
- ExprIterable for interfaces.
changelog_begin
changelog_end
* scalafmt
* interfaces: introduce TemplateOrInterface class in stdlib
The template typeclass is to strong for many applications. The new
constraint `TemplateOrInterface` only contains the methods to convert
contract IDs and choices.
CHANGELOG_BEGIN
CHANGELOG_END
* ghc-lib update, interface script tests
* pinned stackage on unix
* added missing implementation in preprocessor
* added test
* fixing tests
* remove Iface type
* pinned stackage windows
* make sure createAndExercise is not called on interfaces
* Extend ModRef type to include ImpSpec
* Extract 'importOriginFromPackageRef' from 'genModule'
* emitModRef with EmptyImpSpec for all items in the metadata value 'imports'
* Generalize simpleImportTest into dataDependenciesTest, for tests with a multiple-module library and app
* Test that orphan instances are propagated in data-dependencies
changelog_begin
changelog_end
* interfaces: consuming/non-consuming iface choices
We add the consumption behaviour to the interface choice definition and
typecheck accordingly.
CHANGELOG_BEGIN
CHANGELOG_END
update to new ghc-lib, conversion implementation
* update ghc-lib
* pinning stackage on unix
* pin stackage on windows
* Extract 'convertQualifiedModuleName' from 'convertQualified'
* Generate stub definition with orphan module imports
* Test that generated $$imports value has the right contents
* Update InternedTypes test to expect $$imports-related types
changelog_begin
changelog_end
* interface methods: Scala AST
Part of #11006
This PR takes care of the Scala AST and decoder.
It leaves the encoder, type checker, and speedy for later.
changelog_begin
changelog_end
* scalafmt
* AstRewriter
* interface methods: Speedy
Part of #11006
changelog_begin
changelog_end
* scalafmt
* Remove InterfaceMethods test
* Update daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Define encoding/decoding for module imports
First step towards closing #10773
changelog_begin
changelog_end
* Update compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion/MetadataEncoding.hs
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
* interface methods: Haskell AST for methods
Part of #11006. This leaves typechecker and LF conversion for later, on
the haskell side.
changelog_begin
changelog_end
* Forgot ECallInterface in DecodeV1
* fix a test
* interface methods: Add protobuf
Adds protobuf definitions for interface methods and calling them.
Encoders/decoders just ignore the extra stuff or error out.
Part of #10810 (maybe)
changelog_begin
changelog_end
* Update issue numbers where appropriate
* update stable protos
* Add MINIMAL pragma for Additive type class
This ensures that the compiler gives an error if both (-) and negate are missing in an instance
Fixes#11000
changelog_begin
changelog_end
* Add test case to ensure incomplete Additive instance declaration triggers error message
Part of #10810
- Implemented ToInterface, FromInterface in speedy
- Added a test that exercises and fetches an interface
- Fixed a bug in SBUChoiceInterface
Hey, interfaces work now!
changelog_begin
changelog_end
fixes#10977
Turns out assertions are good unless they’re wrong …
This only affects scenarios, the engine never looks at the callback.
changelog_begin
changelog_end
* ifaces: name collision, typecheck fetch/exercise
This adds name collision detection and adds typechecking for
fetch/exercising of interface instances.
CHANGELOG_BEGIN
CHANGELOG_END
* turn on exercises in InterfaceDesugared test case
* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/NameCollision.hs
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
* interfaces: scala typechecker implementation
This is the scala side of the lf typechecker for interfaces.
CHANGELOG_BEGIN
CHANGELOG_END
* added collision check
* added exercise/fetch typechecking
* review suggestions
* added todos for collision/typing scala tests
* Separate exercise & fetch for interfaces from templates
part of #10810
changelog_begin
changelog_end
* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
99% of our usecases use Value[ContractId] so this PR just fixes it.
The few other usescases are:
1. Value[Nothing] which we use for keys. This is technically more
precise but we benefit very little from it.
2. Value[String] mostly because in a few places we are lazy.
We don’t have any code which benefits from being polymorphic in the
contract id type.
changelog_begin
changelog_end
* Desugar interface implements declarations
This PR adds desugaring for tplImplements. This consists of the
corresponding typeclass instance (which we just ignore in LF for now,
we probably need it once we have pure functions) and a _implements_
top-level value.
changelog_begin
changelog_end
* Address review feedback
changelog_begin
changelog_end
- Add support for specifying either 1.2 or 1.3 as minimum TLS versions for ledger api server.
- Log enabled protocols (~TLS versions) and cipher suites at server and client startup.
- Add integration tests against Sandbox-classic and Sandbox
CHANGELOG_BEGIN
Sandbox: Add CLI flag to select minimum enabled TLS version for ledger API server.
CHANGELOG_END
* interfaces: protobuf encoder haskell side
This is the implementation of the protobuf encoder on the haskell side.
CHANGELOG_BEGIN
CHANGELOG_END
* missing decoder cases for added interface data constructor
This only handles the interface definition, not the implementation in
the template. There are also a few rough edges:
1. It maks all choices as consuming.
2. it ignores locations
But for a poc that doesn’t seem too bad.
The tests don’t do anything super useful since the typechecker falls
over but I checked tha tthe generated LF looks more or less reasonable.
changelog_begin
changelog_end
* Add daml interfaces to the Haskell LF AST
Just copied from Sofia’s PR with no changes and stubbed all usages of
it that aren’t trivial.
changelog_begin
changelog_end
Since we switch to scala 2.13, ImmArray companion object extends
`Factory`. Hence:
- the `apply` methods of `ImmArray` override the one from `Factory`
- we can use the notation `.to(ImmArray)` to convert an `Iterable` to
`ImmArray`
This PR drops those `apply` ImmArray. Conversion from Iterable to
`ImmArray` should use the `.to(ImmArray)`.
CHANGELOG_BEGIN
CHANGELOG_END
* Bump ghc-lib to include dropped parsing code for generic templates
changelog_begin
changelog_end
* bump snapshot
changelog_begin
changelog_end
* drop old generics file
changelog_begin
changelog_end
* drop other broken file
changelog_begin
changelog_end
* Bump again
changelog_begin
changelog_end
* bump to merged commit
changelog_begin
changelog_end
* and bump snapshots
changelog_begin
changelog_end
This is a relatively large change unfortunately which unfortunately
requires reimplementing parts of the logic of the typechecker & core
compilation. I don’t think it is too bad but we might want to think
over time if we can factor this better.
This fixes#10073 and fixes#10664 by referencing the exact types
instead of going via the renamer.
There are some minor changes around error messages for "module not
found" errors. This is because these are now caught in the
typechecker instead of in our own code. We could keep the errors but
it requires duplicating even more logic and I don’t really see what it
buys us so I think I prefer the approach here.
changelog_begin
- [Daml Repl] Fix a bug where bindings with out of scope types would result in error in following lines.
changelog_end
Create normalized TXs when a partial TX is finalised.
Except in limited cases! (i.e for scenario-runner, sandbox)
CHANGELOG_BEGIN
CHANGELOG_END
normalize values in the engine as they are converted from speedy-values
fix 2.12 build
backout redundant change
ensure byKey field is correctly normalized when constructed by engine
rename flag: valueNormalization -> transactionNormalization
improve comment
delete commented-out code
rename: toValueNorm --> toNormalizedValue
rename: (SValue.) toValue --> toUnNormalizedValue
revert changes to ptx so that the interface to insertCreate() etc is Value-based (not SValue-based)
improve comments
respell: toUnNormalizedValue --> toUnnormalizedValue
fix build
* Update the channels link in Upgrading.md
* Update the nixpkgs-unstable commit
CHANGELOG_BEGIN
CHANGELOG_END
* Fix new `hlint` warnings.
Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
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