Commit Graph

1277 Commits

Author SHA1 Message Date
Martin Huschenbett
06a33d2c53
DLint: Disable "Redundant pure" lint by default (#8733)
* 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
2021-02-03 17:38:19 +00:00
Robin Krom
6bb76bda58
lsp-tests: test for no internal symbols (#8708)
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
2021-02-02 11:28:22 +01:00
Moritz Kiefer
2528998d00
Generate docs for preview LF version (#8712)
changelog_begin
changelog_end
2021-02-02 10:25:30 +01:00
Robin Krom
5c5c2527a2
lsp-tests: test for no internal imports (#8699)
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
2021-01-29 22:17:21 +01:00
Sofia Faro
44c7b0bd53
Deprecate DA.Next.Set and DA.Next.Map (#8689)
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
2021-01-29 13:29:13 +00:00
Sofia Faro
69b28d2ef2
Add --target=1.12 support in the compiler. (#8673)
* 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.
2021-01-29 12:41:21 +00:00
Moritz Kiefer
5d91a25306
Disable deriving-defaults per file (#8684)
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
2021-01-29 11:01:55 +00:00
Sofia Faro
98fe621066
Add DA.Set to match DA.Map (#8651)
* 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
2021-01-28 16:12:16 +00:00
Robin Krom
ce4fff5133
ghcide: update to newest commit (#8665)
* ghcide: update to newest commit

CHANGELOG_BEGIN
CHANGELOG_END

* update golden tests
2021-01-28 15:03:52 +01:00
Richard Kapolnai
ce5d3bed1e
Add note about loglevel to trace and debug api doc (#4756)
* 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>
2021-01-26 14:56:11 +00:00
Robin Krom
036e46a1ee
damlc: check for inconsistent dependencies (#8619)
* 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
2021-01-26 12:57:24 +01:00
Moritz Kiefer
e0c5abd647
Switch to GHC 8.10.3 (#8394)
* Switch to GHC 8.10.3

changelog_begin
changelog_end

* Update bazel-haskell-deps.bzl

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Comment on rules_haskell patch

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2021-01-25 11:53:53 +00:00
Gary Verhaegen
ce8c38bac1
copyright updates (#8610)
CHANGELOG_BEGIN
CHANGELOG_END
2021-01-22 15:03:36 +00:00
Sofia Faro
438c204fc4
Add choice observers in LF spec. (#8592)
* 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
2021-01-22 13:10:41 +00:00
Georg Schneider
56c1405b60
Fix stdlib docs for unless (#8597)
* Fix stdlib docs for unless

* Fix stdlib docs for unless

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Georg Schneider <georg.schneider@digitalasset.com>
2021-01-22 06:18:55 +01:00
Sofia Faro
461273bb8f
Cleaning up the eval order tests. (#8580)
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
2021-01-21 11:25:41 +00:00
Robin Krom
aa8c1f8fee
damlc: incremental package db initialization (#8541)
* 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
2021-01-20 15:52:37 +01:00
Gary Verhaegen
756b6ce942
update compiler header (#8520)
Channelling my inner Dan.

CHANGELOG_BEGIN
CHANGELOG_END
2021-01-15 12:40:19 +00:00
Robin Krom
32ca8fb831
telemetry: use an extra cache directory for telemetry (#8439)
* 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
2021-01-15 11:44:18 +01:00
Gary Verhaegen
867041ce61
hide with-dlint option (#8506)
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
2021-01-14 18:56:59 +01:00
Moritz Kiefer
427ea0fb7d
Remove redundant list of LF versions (#8490)
* 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
2021-01-13 13:21:39 +00:00
Sofia Faro
51c014b367
Add the missing UTryCatch primitive. (#8462)
* 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 :-(
2021-01-13 10:33:55 +00:00
Gary Verhaegen
9ec54628a2
do not support Eq, Ord, Show for large tuples (#8475)
CHANGELOG_BEGIN
CHANGELOG_END
2021-01-12 17:43:35 +01:00
Sofia Faro
e604ba1fad
Add LFConversion support for exception primitives. (#8427)
* 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
2021-01-11 14:05:24 +00:00
Shaul Kfir
7b409b9e87
Typo fix in fmap documentation (#8350)
changelog_begin
changelog_end
2021-01-11 11:01:44 +00:00
Moritz Kiefer
22ce940954
Upgrade scalafmt and enable trailing commas (#8437)
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
2021-01-09 11:37:37 +01:00
Bernhard Elsner
cda93db944
Daml case and logo (#8433)
* 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
2021-01-08 12:50:15 +00:00
Moritz Kiefer
424faa923a
Port damlc dependencies to Scala 2.13 (#8423)
* 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>
2021-01-08 07:22:38 +01:00
Andreas Herrmann
fa45a58b50
Avoid compiling damlc twice (#8428)
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>
2021-01-07 16:58:32 +01:00
Remy
440b17af24
LF : Fix/Clean some LF related TODOs (#8387)
CHANGELOG_BEGIN
CHANGELOG_END
2021-01-07 15:13:28 +01:00
Sofia Faro
df5b98425e
Add DA.Maybe to preprocessor exceptions. (#8424)
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
2021-01-07 14:09:29 +00:00
Sofia Faro
699e506a95
Fix hpp bazel rule. (#8399)
Change the name of the rule so it doesn't conflict with the output.

changelog_begin
changelog_end
2021-01-05 16:02:58 +00:00
Sofia Faro
eb6d8c0e95
Cut down data-dependencies test. (#8395)
* 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
2021-01-05 13:11:02 +00:00
Sofia Faro
2c248a411c
Add LF version 1.11 in damlc (#8371)
* Add LF version 1.11 in damlc

This maintains the default as 1.8 for now.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix version1_11 doc
2021-01-04 14:53:00 +00:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Gary Verhaegen
93f449d245
rename master to main (#8245)
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
2020-12-27 14:19:07 +01:00
nickchapman-da
a7891a32b5
Avoid duplicating template let bindings (#8259)
* update ghc-lib patch hash

* update stack-snapshot.yaml

* update ghc-lib patch again

changelog_begin
changelog_end

* update stack-snapshot.yaml

* bazel run @stackage-unpinned//:pin (on linux)

* update ghc patch -- no singleton tuples!

* update stack-snapshot.yaml

* update stackage_snapshot.json

* expect error just once, not repeated 5 times

* remove 4x: --ghc-option -Werror

* ghc-lib patch

* stackage_snapshot.json

* stackage_snapshot.json (really, last commit was the yaml)

* Revert "remove 4x: --ghc-option -Werror"

This reverts commit 34b65fc7b1.

* ci/da-ghc-lib/compile.yml

* stack-snapshot.yaml

* stackage_snapshot.json

* stack pin on windows
2020-12-18 14:33:28 +00:00
Remy
649f740efd
LF: retire ValueVersion (#8303)
use TransactionVersion instead.

This is part of #7788

CHANGELOG_BEGIN
CHANGELOG_END
2020-12-17 17:35:43 +01:00
Sofia Faro
33df124d84
Throw exceptions directly. (#8320)
* 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
2020-12-17 14:14:46 +00:00
Jost Berthold
04a6d4c86c
HOTFIX bump versions for Haskell LF libraries (#8287)
* HOTFIX update LF lib extraction to 0.1.8.0 + add new things

* HOTFIX add a dummy project file for testing

CHANGELOG_BEGIN
CHANGELOG_END
2020-12-17 17:41:09 +11:00
nickchapman-da
2d511b449d
Make choice observers mandatory when available. (#8316)
* 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>
2020-12-16 14:38:25 +00:00
Martin Huschenbett
3c5191acb8
damlc: Don't warn on ExplicitNamespaces extension (#8285)
* 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
2020-12-15 12:10:38 +00:00
Sofia Faro
e52c2a0252
Bundle ghcversion.h and hpp with damlc. (#8278)
* 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.
2020-12-14 17:23:41 +00:00
Remy
7d31135645
LF: retire VersionTimeline (#8273)
CHANGELOG_BEGIN
CHANGELOG_END
2020-12-14 16:56:47 +01:00
Robin Krom
54e442b2e5
damlc: warn on bad package names/versions. (#8254)
* 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
2020-12-14 16:44:43 +01:00
Remy
44c5b8a777
LF: remove version from value nested in GenNode. (#8217)
CHANGELOG_BEGIN
CHANGELOG_END
2020-12-11 17:12:14 +01:00
Remy
009b030463
LF: Simplify Language Version representation (#8258)
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
2020-12-11 16:21:45 +01:00
Moritz Kiefer
5c077a4550
Add multi-party submissions to DAML Script (#8240)
* Add multi-party submissions to DAML Script

changelog_begin

- [DAMl Script] Add early-access submitMulti and submitMultiMustFail
  for multi-party submissions. This is only supported in DAML Studio at
  the moment.

changelog_end

* Fix daml-lf prettyprinter

changelog_begin
changelog_end

* Cleanup visibleIn

changelog_begin
changelog_end

* Fix JsonApiIt

changelog_begin
changelog_end

* s/Set()/Set.empty

changelog_begin
changelog_end

* Cleanup token check

changelog_begin
changelog_end

* Update daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/LedgerInteraction.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Document ParticipantView

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-12-11 12:45:32 +01:00
Gary Verhaegen
05b5473a76
replace daml-licenses with NOTICES (#8241)
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
2020-12-10 16:46:13 +01:00
Gary Verhaegen
be2ad76897
fix link to AST (#8238)
CHANGELOG_BEGIN
CHANGELOG_END
2020-12-10 15:48:58 +01:00