Commit Graph

1135 Commits

Author SHA1 Message Date
Moritz Kiefer
5f7d6fd6cc
Properly mangle/unmangle names in the scenario service (#5595)
* Properly mangle/unmangle names in the scenario service

Previously, we just passed in whatever we had in DAML land which broke
the scenario service as soon as a name needed mangling. This PR fixes
mangling when passing identifiers to the scenario service and
unmangles them again when pretty printing.

fixes #5593

changelog_begin

- [DAML Studio] Fix a bug where scenarios with names that are mangled
  in DAML-LF resulted in a crash in the scenario service.

changelog_end

* Mangle module names in context updates
2020-04-17 12:26:40 +02:00
Moritz Kiefer
9863e31ee2
Refactor createProjectPackageDb (#5580)
This is a first step in probably a series of PRs to cleanup the
packaging logic.

There is no change in functionality (or at least none that is
intended). The changes boil down to two things:

1. Add a `DependencyInfo` type that stores the various maps and has
   detailed comments what exactly is in each map and hopefully somewhat
   descriptive field names.
2. Move a lot of the logic in `createProjectPackageDb` into various
   helper functions.

There is definitely a lot more cleanup and refactoring that we can do
here but I’ll try to keep it in manageable chunks.

changelog_begin
changelog_end
2020-04-16 15:54:48 +02:00
Moritz Kiefer
69ac459723
Add a suggestion when warning about unexposed modules (#5581)
This has come up today where someone didn’t realize that removing the
field is sufficient to fix the warning.

I’ve also taken this as an opportunity to move the code out to a
helper function.

changelog_begin
changelog_end
2020-04-16 15:29:13 +02:00
Remy
9704a39bae
Engine: refactor PartialTransaction context (#5578)
* Engine: refactor PartialTransaction context

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-16 14:39:12 +02:00
Moritz Kiefer
18349be069
Fix conversion from contract to node ids in the scenario service (#5577)
* Fix conversion from contract to node ids in the scenario service

Previously we only included the mapping from the ledger. However, this
does not include any contracts which might have been created in a
partial transaction that failed. This caused a
`NoSuchElementException` when converting the error which is obviously
not what we want.

This PR extends the mapping to include any contracts created in the
current partial transaction.

changelog_begin

- [DAML Studio] Fix a bug where a failed transaction that included
  references to a transient contract returned a gRPC error instead of
  the expected error message.

changelog_end

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala

Co-Authored-By: Remy <remy.haemmerle@daml.com>

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-04-16 09:34:20 +00:00
Moritz Kiefer
d83387a64d
Improve error messages in daml repl on calls to error (#5565)
* Improve error messages in daml repl on calls to `error`

There were two issues with calls to `error`:

1. This one is harmless but somewhat annoying: When calling `error` we
   run into the log statement in `stepToValue` which prints out the
   error message in a fairly reasonable form (you can argue whether
   Error: User abort: is a super useful prefix but that’s a relatively
   minor issue). Afterwards we then call `println` on the failed
   future. However, that will just print the type of the exception
   which isn’t something we want to show to users. I’ve just disabled
   the println statement if the exception is `SError`.

2. This one is a bigger issue: `throw x` is not the same as
   `Future.failed(x)`. I only fully realized the difference fairly
   recently. The former fails before it produces a future. So `(throw
   x).onComplete(…)` will never execute the callback. The latter is
   just a failed future. It is rather confusing to have a function
   that returns a future but then throws an exception instead of a
   future and it confuses the grpc library which prints out a horrible
   exception. I’ve changed all calls to `throw` in `runWithClients` to
   instead use `Future.failed` and `flatMap` (in the form of
   for-comprehensions).
   There are still a few calls in `run` left which I’ll leave for a
   separate PR.

I think we need to factor out some helper functions here to make this
a bit more manageable (e.g. for the Converter.toFuture) stuff but I’ll
leave that for a separate PR. You probably want to view this with
whitespace diffs disabled.

changelog_begin

- [DAML Repl] DAML Repl now produces better error messages on calls to
  `error` and `abort`.

changelog_end

* Switch stepToValue to return Either
2020-04-15 16:19:36 +00:00
Remy
32967f7294
Engine: redesign PartialTransaction context (#5519)
* Engine: redesign PartialTransaction context

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-15 17:35:01 +02:00
Moritz Kiefer
10d7c2b5dc
Refactor mkConfFile (#5546)
mkConfFile was a bit of a mess before. Half of the arguments we passed
in via `PackageConfigFields` were unused as shown by the fact that we
set them to `error …` in various places where we did not have that
information. More importantly rather than passing in the unit ids
which need to end up in the GHC package config, we passed in file
names which required us to parse the DAR again and have a bunch of
hacks where file names with .dalf endings were not translated.

This PR changes this to only pass in the fields we need and pass in
dependencies directly as unit ids.

changelog_begin
changelog_end
2020-04-15 12:18:31 +02:00
Moritz Kiefer
e7c887a7ee
Fix unstableSplitOn (#5523)
* Fix unstableSplitOn

unstableSplitOn is supposed to behave like splitOn but fast™ but it
didn’t live up to that promise for a few reasons:

1. Java’s split method by default drops empty strings at the
   end. Passing a second negative parameter avoids that.
2. Java’s split method does regex splitting so we need to quote the
   string.
3. Java’s split method splits on an empty pattern whereas we want to
   simply preserve the input.

I’ve added regression tests for this and for unstableDrop and a few
other functions while I was at it.

changelog_begin
changelog_end

* Update compiler/damlc/tests/daml-test-files/UnstableText.daml

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-04-09 17:13:14 +00:00
Moritz Kiefer
45f4905587
Fix SINCE annotation in TemplateTypeRep tests (#5524)
We forgot to change this to 1.7 once we released that.

changelog_begin
changelog_end
2020-04-09 18:31:09 +02:00
Martin Huschenbett
06632267e9
Haskell: Add assertFileExists to DA.Test.Util (#5520)
* Haskell: Add assertFileExists to DA.Test.Util

This PR adds a helper function `assertFileExists` that captures the
`doesFileExist ... >>= assertBool ...` pattern that is very common in
our Haskell test suites. It also adds the inverse
`assertFileDoesNotExist` function. Both functions are now used where
appropriate.

CHANGELOG_BEGIN
CHANGELOG_END

* Add directory dependency to test-util lib

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-09 15:29:31 +00:00
Moritz Kiefer
5dd196ac4a
Move GHC session to a Shake rule (#5517)
This is a spin off from the work for making module prefixing
work. There I wanted to be able to use the `GeneratePackageMap` rule
to get access to the modules in an LF package which requires to be in
an Action rather than in IO.

This resulted in a much larger refactoring than I expected, so here is
a list of changes to ease review:

1. I’ve split off Development/IDE/Core/RuleTypes/Daml.hs into its own
   Bazel targets to avoid cycles. This allows us to use a rule without
   depending on the implementation of that rule.

2. Development/IDE/Core/IdeState/Daml.hs has moved into its own Bazel
   target. There is a lot of stuff that needs `withDamlIdeState` now
   since the `ghcide` `initialise` function does not add our Shake rule
   for getting the GHC session and making all of that depend on
   damlc:lib creates a mess.

3. The actual logic of the initialization has stayed the same but
   moved into a rule in Development/IDE/Core/Rules/Daml.hs.

4. As mentioned above, a few things that could previously get away
   with only the rules provided by ghcide now need our own rules so
   they switched to `withDamlIdeState`. This mainly affects `damlc
   docs`.

5. Making daml-docs work with the ofInterestRule is a bit tricky.I did
   find the issue and included the fix but also disabled the
   ofInterestRule since it really does not make sense to generate Core
   in the background.

changelog_begin
changelog_end
2020-04-09 17:11:40 +02:00
Gerolf Seitz
97433743a1
Set the Bearer prefix in bindings. (#5484)
* Set the `Bearer ` prefix in bindings.
* Make the `Bearer ` prefix in the authorization header mandatory.
* Bearer prefix can be removed from the token file.

CHANGELOG_BEGIN
[Extractor]: The ``Bearer `` prefix can be removed from the token file.
It is added automatically.
[Navigator]: The ``Bearer `` prefix can be removed from the token file.
It is added automatically.
[DAML Script] The ``Bearer `` prefix can be removed from the token file. It
is added automatically.
[DAML Repl] The ``Bearer `` prefix can be removed from the token file. It is
added automatically.
[Scala Bindings] The ``Bearer `` prefix can be removed from the token. It is
added automatically.
[Java Bindings] The ``Bearer `` prefix can be removed from the token. It is
added automatically.
[DAML Integration Kit] ``AuthService`` implementations MUST read the
``Authorization`` header and the value of the header MUST start with
``Bearer ``.
CHANGELOG_END
2020-04-08 13:07:28 +02:00
Moritz Kiefer
6af5b97273
Split up repl tests to make them faster (#5450)
* Split up repl tests to make them faster

This PR splits up the tests into the tests for TLS and Auth and the
tests for the actual functionality.

The func tests use the repl as a library which allows them to be
significantly faster:

1. We only need to start the service process once.
2. We only need to initialize the package db once.

There is at least one other point that I did not address for now and
that is only loading the packages into the repl service once. While
loading them multiple times is a noop, it still has a performance
implication.

Sadly, this has turned out much more messy than I thought it would be
due to various issues with haskeline/repline/tasty/computers. The
details are in a comment in DA.Test.Repl.FuncTests.

changelog_begin
changelog_end

* Try to nuke cache on window selectively

* Enable cache again
2020-04-07 10:22:15 +02:00
Gerolf Seitz
a2d785e3ee
Use com.daml as root package (#5343)
Packages com.digitalasset.daml and com.daml have been unified under com.daml

Ledger API and DAML-LF DEV protos have also been moved from `com/digitalasset`
to `com/daml` on the file system.
Protos for already released DAML LF versions (1.6, 1.7, 1.8) stay in the
package `com.digitalasset`.

CHANGELOG_BEGIN
[SDK] All Java and Scala packages starting with
``com.digitalasset.daml`` and ``com.digitalasset`` are now consolidated
under ``com.daml``. Simply changing imports should be enough to
migrate your code.
CHANGELOG_END
2020-04-05 19:49:57 +02:00
Andreas Herrmann
e3c9bf9615
Remove debug output in REPL test (#5430)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-04-03 15:17:34 +00:00
Martin Huschenbett
ccfb17c91b
Rename daml codegen ts to daml codegen js (#5409)
I've completely removed the possibility to call `daml codegen ts`. I'm
happy to add in back in a followup PR once I've seen that all our tests
pass without it existing.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-03 14:54:46 +00:00
Bernhard Elsner
c496e2bf05
Relabel "Experimental" to "Early Access" and reorganise pages (#5411)
CHANGELOG_BEGIN

- Move daml2ts, bindings-ts and JSON API out of experimental section in docs
- Rename Experimental to Early Access in docs and assistant
- Reorganise the docs a little bit to de-emphasise the Ledger API

CHANGELOG_END
2020-04-03 16:29:22 +02:00
Andreas Herrmann
2d1e22fe33
Support import in DAML REPL (#5386)
* REPL parse import statements

* Factor parsing out of handleLine

* Pull binding and error handling into handleStmt

This is specific to the case of handling a statemt and does not overlap
with handling imports.

* Track module imports as ImportDecl

* Add new module imports

* Validate module imports

* Add REPL interaction test for import

* REPL document import declarations

CHANGELOG_BEGIN
- [DAML REPL - Experimental] You can now use import declarations at the
  REPL prompt to bring additional modules into scope.
CHANGELOG_END

* ReplState strict fields

* Use semigroupoids Alt to simplify parseReplInput

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-04-03 10:43:04 +00:00
Andreas Herrmann
36c3c95933
Regression test for silent REPL server errors (#5347)
* Regression test for silent REPL server errors

CHANGELOG_BEGIN
CHANGELOG_END

* Fix script error test case

We get an error print out by the REPL server as well

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-04-03 09:59:06 +00:00
Moritz Kiefer
2049f2ea93
Limit memory usage of scenario service in tests (#5373)
* Limit memory usage of scenario service in tests

Previously the scenario service used over 2GB of memory during
//compiler/damlc/tests:integration-dev for absolutely no reason.

This PR adds an option to pass JVM options when starting the scenario
service and sets them to 200MB for the Shake tests and the damlc
integration tests which seems to be more than sufficient.

These option can also be set in `daml.yaml`. I did not change the
defaults since this is shipped to users where I’d rather have high
memory usage than a crashing scenario service and on certain large
DAML codebases we might actually use a fair bit.

changelog_begin
changelog_end

* Update docs/source/tools/assistant.rst

Co-Authored-By: Samir Talwar <samir.talwar@digitalasset.com>

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-04-02 14:42:33 +00:00
Moritz Kiefer
e3a0ec9dcf
Replace unstable-types tests by a Haskell test suite (#5363)
* Replace unstable-types tests by a Haskell test suite

The JQ based test suite is absurdly slow, it takes around 60s to run
on my machine. The Haskell test suite on the other hand takes less
than 2s on my machine so this is a speedup of over 30x and I have to
read less bash.

changelog_begin
changelog_end

* Address review comments
2020-04-02 12:12:46 +00:00
nickchapman-da
ddc11a7063
Refactor deployment tests: (#5342)
- Move deployment tests (deployTest, fetchTest) out of integration-tests.
- Use DA.Test.Sandbox where appropriate.
- Split out code for useful test patterns: i.e. calling commands quietly, getFreePort.

changelog_begin
changelog_end
2020-04-02 10:17:21 +01:00
Moritz Kiefer
a11a2c72b0
Fix leak of scenario contexts (#5349)
The details are in a comment since I want to preserve them. Please
review carefully, I don’t trust my async exception foo.

This is only an issue in the integration tests I believe since we
change files of interest all the time. As long as you stay stable at
some point for some amount of time, we will GC properly either way.

In my tests, this reduces memory usage of the scenario service in the
integration tests from 3 to 2 GiB. There is sadly
anther leak somewhere (contexts are properly GCd now, I verified that
we never have more than 3 contexts in the server). I’ll do some more
investigation but memory grows linearly to the 2GiB while it should
stay pretty much constant.

changelog_begin
changelog_end
2020-04-02 10:56:21 +02:00
Andreas Herrmann
90c94b0076
Use repline for DAML REPL (#5337)
* Use repline for DAML REPL

CHANGELOG_BEGIN
CHANGELOG_END

* REPL server print error messages

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-04-01 13:13:46 +00:00
Moritz Kiefer
29ed16b4cc
Improve handling of exposed-modules with data-dependencies (#5330)
* Improve handling of exposed-modules with data-dependencies

Previously, we tried to rename all modules of a dependency via
--package. This fails if some of those modules are not exported. This
was trivial to hit as a user since the ``daml-trigger`` library made
use of this.

This PR adds a few things to improve the situation:

1. We only rename modules that are exposed. This fixes the issue if
   you don’t actually reference a non-exposed module from your
   data-dependency.
2. I’ve removed the exposed-modules from daml-trigger. I don’t think
   they are essential here given that the module name has `Internal`
   in the name and it’s too easy to have something that actually
   references the non-exposed module since the types are reexported.
3. I’ve added documentation that mentions this issue.
4. I’ve added a warning if your exposed-modules are excluding some
   modules. Maybe worth turning this into an error in the future.

changelog_begin
changelog_end

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

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

Co-authored-by: associahedron <231829+associahedron@users.noreply.github.com>
2020-04-01 13:57:52 +02:00
Shayne Fletcher
6daf37c4da
Make 'callProcessSilent' a test library function (#5323)
changelog_begin
changelog_end
2020-04-01 11:42:00 +00:00
Shayne Fletcher
6e94197544
Upgrade daml2ts test to a more recent davl (#5316)
changelog_begin
changelog_end
2020-03-31 18:10:46 +00:00
Martin Huschenbett
220a6bdd81
damlc: Fail integration tests with outdated UNTIL-LF annotation (#5298)
Until #5294, we had some test cases for `damlc` flying around there
were never run because they had an upper bound on an unsupported
DAML-LF version. This PR makes sure we'll clean up such test cases in
the future.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 16:02:42 +02:00
Remy
1d0c0df325
Scenario serice: use new contract ids (#5296)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 14:37:41 +02:00
associahedron
c0fe6997f4
Move PackageConfigFields and related function into a separate package. (#5275)
* Extract package config type to a separate package.

changelog_begin
changelog_end

* update copyright headers

* run buildifier-fix

* fix src_strip_prefix

* Heres the file I accidentally deleted

* buildifier-fix again
2020-03-31 12:26:13 +00:00
Martin Huschenbett
66653810ab
damlc: Drop support for reading DAML-LF 1.5 (#5294)
DAML-LF 1.6 is the baseline vesion we want to support with the next
SDK release.

CHANGELOG_BEGIN
- [DAML Compiler] Drop support for reading DARs using DAML-LF 1.5.
  Please recompile your DAML to a newer DAML-LF version in case you
  have such DARs.
CHANGELOG_END
2020-03-31 11:02:24 +00:00
Andreas Herrmann
89a9f5c7d2
tarball reproducibility (#5258)
* integration-tests reproducibility

* package-app reproducibility

* Make remaining tar czf reproducible

* package-app

CHANGELOG_BEGIN
CHANGELOG_END

* Reproducibility of remaing tar invocation

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-31 10:09:52 +02:00
Moritz Kiefer
c0e28d83ee
Turn warnings for module name/record name mismatches into errors (#5266)
* Turn warnings for module name/record name mismatches into errors

The module name warning existed for ages. We started warning about the
record name mismatch in 0.13.55 so I’d like to turn it into an error
before 1.0

changelog_begin

- [DAML Compiler] File names must now match up with module names. This
  already produced a warning in previous releases.

- [DAML Compiler] It is now an error to define a record with a single
  constructor where the constructor does not match the type
  name. To fix the error you need to change ```data X = Y { … }``` to
  ```data X = X { … }```.  This restriction only applies to
  single-constructor records. Variants and enums are not affected.
  This already produced a warning in 0.13.55.

changelog_end

* Fix integration tests

* Fix docs

* Fix lsp tests
2020-03-30 10:21:53 +00:00
Remy
1b37f6c482
DAML-LF: redesign absolute contract ids (#5207)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 19:07:42 +01:00
nickchapman-da
aa53c30de1
New command: daml ledger fetch-dar (#5225)
* New comamnd: daml ledger fetch-dar

`daml ledger fetch-dar [PID] [PATH]`

Download a `Package` and it's dependencies from a ledger, given a root `packageId`, and re-construct a valid `.dar` file. Addresses issue #5037.

The original package names are not reconstructed.

CHANGELOG_BEGIN
CHANGELOG_END

* address some comments

* fix spello

* attempt: recoverPackageName

* recover main package name & version

* Try to fix integration tests on Windows

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-03-27 18:04:14 +00:00
Moritz Kiefer
53994c807a
Disable tuple-section and lambda-case hints (#5229)
Adding more syntax is just confusing for beginners so these are not
particularly helpful and I would argue that they aren’t that useful in
general even once you move past the beginner stage.

changelog_begin
changelog_end
2020-03-27 17:16:25 +01:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Moritz Kiefer
b950692db1
Attempt to fix packaging tests on Windows (#5222)
I don’t really understand why they might fail but exceptions are weird
so maybe printing to stderr explicitly helps.

changelog_begin
changelog_end
2020-03-26 19:47:36 +01:00
Moritz Kiefer
17d82bf076
Make name collision check more strict (#5219)
* Make name collision check more strict

This PR extends the name collision check to catch collisions between
A:B (type B in module A) and module A.B.C. For now this is just a
warning and not an error. Once we turn it into an error, we also need
to add this to the Scala collision checker.

There is a fair bit of plumbing required to make warnings work but on
the plus side we get multiple errors at once now instead of erroring
out on the first one.

changelog_begin

- [DAML Compiler] The name collision check has been extended to also
  count the case as a collision where you have a type B in module A and a module
  A.B.C (but no module A.B). This is a warning in this SDK release but
  will become an error in a future release. The typescript codegen is
  not usable on packages that don’t uphold this restriction.

changelog_end

* Address review comments
2020-03-26 19:24:34 +01:00
Andreas Herrmann
40e439ad15
Remove unused //compiler/daml-licenses and //:notices-gen (#5221)
* Remove unused da_doc_package

The only use-site was `//compiler/daml-licenses:daml-licenses`, which
itself was unused.

* Remove unused notices-gen

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 17:33:11 +00:00
Ognjen Maric
f7aa2a3db0
Add keys with maintainers to Fetch nodes (#5186)
Add keys with maintainers to Fetch nodes

The new field is populated by the interpreter whenever the fetched
contract has a key. Used for contract key reinterpretation in Canton.

CHANGELOG_BEGIN

- [DAML-LF] Add keys with maintainers to Fetch nodes in transactions.

CHANGELOG_END
2020-03-26 14:07:17 +01:00
Andreas Herrmann
9e5dff4109
Ship daml-script and daml-trigger libraries in multiple LF versions (#5192)
* Depend on LF version specific daml-libs

* daml-script.dar build multiple LF versions

CHANGELOG_BEGIN
[DAML Script] The `daml-script` library is now available in multiple LF
  versions, namely 1.7, 1.8, and 1.dev.
CHANGELOG_END

* daml-trigger.dar build multiple LF versions

[DAML Triggers] The `daml-trigger` library is now available in multiple
  LF versions, namely 1.7, 1.8, and 1.dev.

* Keep daml-script.dar available for tests

* Keep daml-trigger.dar available for tests

* daml-libs LF versions integration test

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-26 10:17:19 +01:00
Moritz Kiefer
46be910ba1
Abstract over ledger interaction in DAML script (#5184)
This PR adds as `ScriptLedgerClient` trait (happy to change the name
if anyone has a better proposal) that abstracts over the interaction
with the ledger. This will allow us to plug in a different
implementation for interacting with the JSON API so we can run DAML
scripts against DABL or other environments where gRPC is not a
workable option. Note that this PR does not yet add the implementation
for interacting with the JSON API. I’ll leave that for a separate PR.

changelog_begin
changelog_end
2020-03-25 15:26:18 +01:00
Robert Autenrieth
3f597aae16
New ledger time (#5100)
* Tighten result type

Command execution can't result in a sequencer error

* New helper method for extracting used contracts

* New error clause

* Add a DAO query for the maximum time of contracts

* Implement algorithm for finding ledger time

CHANGELOG_BEGIN
CHANGELOG_END

* fixup ledgerTimeHelper

* Use new ledger time algorithm

* Mark LET/MRT as deprecated

CHANGELOG_BEGIN
- [Ledger API] DAML ledgers have switched to a new ledger time model.
  The ledger_effective_time and maximum_record_time fields of command submission are deprecated,
  the ledger time of transactions is instead set automatically by the ledger API server.
  Ledger time is no longer strictly monotonically increasing, but only follows causal monotonicity:
  ledger time of transactions is greater than or equal to the ledger time of any used contract.
  See `#4345 <https://github.com/digital-asset/daml/issues/4345>`__.
CHANGELOG_END

* Add ledger time skew check

* Remove command updater

LET/MRT are now deprecated, this class is now useless

* Remove old time model validator

* Switch to new time model check: kvutils

* Switch to new time model check: in-memory ledger

* Switch to new time model check: SqlLedger

* Use initial ledger config

* Ignore user provided LET

* Use TimeProvider in submission services

* Use deduplication_time in daml-script runner

- Also remove unnecessary command completion output of CommandTracker.
- Remove usage of maximum record time in CommandTracker.

* Use arbitrary default value for deduplication time

* Use built-in Instant ordering

* Remove obsolete test

* Remove obsolete test: CommandStaticTimeIT

* Refactor test: TransactionMRTCompliance

* Disable test: CommandTrackerFlow timeout

* thread maxDeduplicationTime through to CommandTracker

* Improve test

* Refactor command client configuration

* Deduplication time should always use UTC

* Add missing method in TimedIndexService after rebase

* Put more details into the deduplication error response.

* Use system time for command dedup submittedAt.

* Use explicit UTC time source in command validator

* Revert CommandTracker[Flow] to previous completion-recovering-behavior

* Adapt scala client command config to new config params

Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2020-03-25 09:28:56 +01:00
Moritz Kiefer
37dc2f29d3
Integrate create-daml-app into the assistant (#5152)
* Integrate create-daml-app into the assistant

fixes #4868

changelog_begin

- [DAML Assistant] Add a new ``daml create-daml-app`` command for creating a project based on
  `create-daml-app <https://github.com/digital-asset/create-daml-app>`_.

changelog_end

* Try random things hoping to fix windows

* Try random things hoping to fix things on macos
2020-03-24 18:29:40 +01:00
Andreas Herrmann
3b550b9933
Avoid recompiling loaded packages in REPL (#5157)
* Use MutableCompiledPackages in REPL

This avoids unnecessary recompilation of loaded packages.

CHANGELOG_BEGIN
CHANGELOG_END

* Track compiled definitions explicitly

Compile packages on load directly.

Use `PureCompiledPackages` extended with package for current line in
REPL service `runScript`.

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-24 16:53:40 +00:00
Moritz Kiefer
2b47f6994d
Switch default DAML-LF target to 1.8 (#5127)
changelog_begin

- [DAML Compiler] The default output DAML-LF target version is now
  1.8. You can target 1.7 by specifying ``--target=1.7`` in the
  ``build-options`` field in your ``daml.yaml``.

changelog_end

Fix daml2ts tests
2020-03-24 11:02:13 +01:00
Moritz Kiefer
5cb7fc7c19
Disable bifunctor dlint rules (#5149)
changelog_begin
changelog_end
2020-03-24 10:43:05 +01:00
Moritz Kiefer
aa48f3026e
Bump ghcide (#5128)
This PR bumps ghcide, haskell-lsp and haskell-lsp-types. There aren’t
really any important changes in ghcide itself but the haskell-lsp
update includes my fix for crashing completions.

One change in ghcide itself is that NormalizedFilePath got moved to
haskell-lsp. ghcide needs special treatment for empty file paths so we
use `toNormalizedFilePath'` from ghcide instead of
`toNormalizedFilePath` from `haskell-lsp`. I’ve added an hlint rule to
enforce this.

changelog_begin
changelog_end
2020-03-23 12:09:36 +00:00
Shayne Fletcher
2525a4610a
Update hlint (#5123)
changelog_begin
changelog_end
2020-03-22 16:30:11 +00:00
Andreas Herrmann
4f7c52c981
DAML script runner takes CompiledPackages (#5110)
* daml-script runner from compiledPackages

* Factor out script parameter conversion

* Use ADT for DAML script (Action & Function)

* run --> runwithClients

* DAMl script Runner `run` convenience function

* REPL use pure script runner constructor

* DAML script runner holds script itself

* scalafmt

* comments

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-20 17:52:54 +00:00
Moritz Kiefer
be7f0802c6
Bump ghcide (#5103)
This includes some completion improvements.

changelog_begin
changelog_end
2020-03-20 16:43:59 +00:00
Moritz Kiefer
be90649186
Support partial patterns in DAML repl (#5093)
* Support partial patterns in DAML repl

This PR improves the support for partial patterns in DAML repl by
making sure that they fail on the line itself rather than some
subsequent line and avoids the partial pattern match warnings on all
following lines.

changelog_begin
changelog_end

* Fix tests
2020-03-19 17:28:40 +00:00
Moritz Kiefer
c2c0557970
Support complex patterns in DAML REPL (#5087)
* Support complex patterns in DAML REPL

Previously, we only supported simple variable patterns in DAML
repl. This PR extends this to support pretty much all patterns. The
main complexity here is in handling shadowing correctly but I’m
reasonably confident the solution here is sensible.

What doesn’t work properly yet is partial patterns. I’ve added a
comment describing the issue and a potential solution. Given that this
isn’t a regression apart from maybe a slightly worse error message, I
think it makes sense to merge this PR and fix that separately.

changelog_begin

- [DAML REPL - Experimental] You can now use more complex patterns in
  statements, e.g., ``(x,y) <- pure (1,2)``.

changelog_end

* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Repl.hs

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

* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Repl.hs

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

* Improve error messages

* update documentation

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-03-19 16:17:50 +00:00
Andreas Herrmann
8527ec4c4b
Infer daml-script package id from script (#5076)
* Factor out common identifier generation

For `DA.Types`, `DA.Internal.Any`, and `Daml.Script`.

* Factor out Script type for DAML scripts

* Adapt DAML script test runners

* Adapt REPL

CHANGELOG_BEGIN
CHANGELOG_END

* ./fmt.sh

* Avoid `unapply`

addressing
https://github.com/digital-asset/daml/pull/5076#discussion_r394526881

* Pure Script.fromIdentifier

* Pure Script.fromDar

* Simplify test script discovery

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-19 11:59:06 +00:00
associahedron
6ea118d614
Update DA.Map to reflect generic order. (#5060)
* Update DA.Map to reflect generic order.

changelog_begin
changelog_end

* Improve example built-in types
2020-03-18 11:07:49 +00:00
Moritz Kiefer
3da5e4fae7
Give repl tests a long timeout (#5034)
Apparently adding the TLS and auth tests has made this necessary now.

changelog_begin
changelog_end
2020-03-16 20:43:30 +00:00
associahedron
80d96ce39f
Use new primitives in tagToEnum# conversion. (#5025)
changelog_begin
changelog_end
2020-03-16 16:27:12 +00:00
Moritz Kiefer
1956dd2f89
Update checked in DAR to one built with DAML-LF 1.8 (#5021)
1.dev is changing in ways wich break this as predicted by the comment,
so let’s freeze this now that we have a release that supports this.

changelog_begin
changelog_end
2020-03-16 16:54:19 +01:00
associahedron
8911234ae3
Use new generic comparison primitives. (#5014)
This PR exposes the new generic comparison primitives, preferring them
to the older comparison primitives whenever they are available. It also
separates the generic comparison feature from the GenMap feature,
because that just makes sense.

changelog_begin
changelog_end
2020-03-16 12:10:03 +00:00
Moritz Kiefer
44d843f9ef
Support authentication and TLS in DAML repl (#4998)
* Support authentication and TLS in DAML repl

changelog_begin

- [DAML Repl - Experimental] You can now connect to a ledger via TLS
  by passing ``--tls`` to ``daml repl``

- [DAML Repl - Experimental] You can now connect to a ledger with
  authentication by passing the token via ``--access-token-file`` to
  ``daml repl``.

changelog_end

* try to fix linking on windows

* windows is weird

* gnah
2020-03-16 10:43:57 +01:00
Moritz Kiefer
39bb4eb1f7
Set sdk version in damlc package (#4999)
While `damlc package` should really just go away, the fix here is
simple enough that it makes sense to include it.

fixes #4994

changelog_begin
changelog_end
2020-03-16 10:15:06 +01:00
Remy
c76e0bc1e0
DAML-LF add support for generic comparison in archive (#4983)
* DAML-LF: add generic comparison to archive
2020-03-13 20:13:13 +01:00
Andreas Herrmann
559c78003e
Update rules_haskell (#4751)
* Update rules_haskell

The workaround for linking against `Cffi` in the REPL has been
upstreamed in a more generalized form.

CHANGELOG_BEGIN
CHANGELOG_END

* ghcide: Use rules_haskell's hie-bios support

* Document `ghcide` Bazel integration

* Rename files to match module names

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-13 16:49:34 +01:00
Moritz Kiefer
a15bfd80f3
Fix lf versions in the tests for buliding against newer LF versions (#4933)
This makes sure that they won’t break once we switch defaults. For
consistency they are specified via `build-options` everywhere.

changelog_begin
changelog_end
2020-03-13 16:27:54 +01:00
Moritz Kiefer
4e99f18613
Introduce a DA.Test.Sandbox module for managing sandbox in tasty (#4986)
We previously had 3 slightly different but consistently shitty logic
for handling this in the tests for daml-helper daml repl and the
Haskell ledger bindings. This PR introduces a module that is flexible
enough to capture all their needs and hopefully is somewhat less
shitty.

changelog_begin
changelog_end
2020-03-13 15:35:03 +01:00
Remy
277883e4d5
DAML-LF: base GenMap on SortedMap (#4893)
Change underlying implementation of GenMap from insertion order Map to sorted Map

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-13 11:10:38 +01:00
Moritz Kiefer
58c101c3ab
Mark lsp tests as flaky on Windows (#4906)
:sadpanda:

changelog_begin
changelog_end
2020-03-09 16:53:36 +01:00
Moritz Kiefer
7b1f193012
Error out on dependencies on newer LF versions (#4901)
This doesn’t really make sense since the main point of targetting an older
LF version is because your server does not support the newer LF
version but including dependencies in newer LF versions makes that
completely useless. In the current state, this also produces a bunch
of errors that look very confusing and while we might be able to fix
them, I don’t think it’s worth doing.

changelog_begin
changelog_end

fixes #4596
2020-03-09 14:59:34 +00:00
associahedron
e67fef1d27
Add extra test on record constructor check. (#4898)
Based on @hurryabit's comments from last PR.

changelog_begin
changelog_end
2020-03-09 14:31:47 +00:00
associahedron
943832bc16
Add a warning for data X = Y {...}. (#4892)
* Add a warning for data X = Y {..}.

Part of #4718.

changelog_begin

- [DAML Compiler] The DAML compiler now emits a warning when you declare a single-constructor record type where the constructor name does not match the type name, such as ``data X = Y {...}``. This kind of type declaration can cause problems with cross-SDK upgrades because the record constructor name cannot be recorded in the DAML-LF representation. In the future, this warning will be upgraded to an error.

changelog_end

* s/Ctor/Constructor/g
2020-03-09 11:28:16 +00:00
associahedron
02ae2a29d9
data-dependencies: Call buildHiddenRefMap once per package. (#4881)
* Call buildHiddenRefMap once per pkg.

Instead of calling it once per module.

changelog_begin
changelog_end

* Remove special cases
2020-03-06 16:17:57 +00:00
Gary Verhaegen
2eedd291ec
bind repl to localhost (#4863)
Currently the repl server is bound to 0.0.0.0, which is not great for
security and makes running the tests a bit disruptive on macOS.

This binds it to 127.0.0.1 instead.

CHANGELOG_BEGIN
- [DAML Repl - Experimental] The REPL server will now bind to 127.0.0.1
  instead of 0.0.0.0.
CHANGELOG_END
2020-03-06 11:40:55 +01:00
mergify[bot]
1007fd58e6
Track erased types in data-dependencies. (#4833)
* Track erased types in data-dependencies.

This PR introduces a tracker for Erased types, DA.Generics, and any type, typeclass, or typeclass instance that dependens on them transitively. This is designed to detect and cut out any such definition that will cause problems.

Apologies for the large PR. Originally this was just a small extension to the tracking of old-style typeclasses, but each bugfix uncovered a new bug, and the only way to get it to completely work was to do it all at once. That's why the tracker is so extensive -- the only thing it doesn't track is regular functions, because they will never introduce a cyclic reference to an erased type that gets exposed in the type system (until we implement dependent DAML).

Right now the tracker runs once per data-dependency module, but in a future PR I will make it run once per data-dependency package to reduce the repetitive. This was all tested on a very large DAR, and it runs fine, but it should be much faster once it runs once per package.

changelog_begin
changelog_end

* lint

* Address comments

* Add a great test case
2020-03-05 17:54:55 +00:00
mergify[bot]
60013a1535
Remove DA.Upgrade module (#4839)
Given that Generic instances are not supported cross-SDK this module
only causes confusion and I’d rather remove it.

changelog_begin
changelog_end
2020-03-05 16:30:54 +00:00
Gary Verhaegen
75c7d48d5b
bind localhost for json-api and scenarios (#4576)
Both were previously binding 0.0.0.0, which is inherently insecure. More
importantly to me, that meant running `bazel test //...` essentially
rendered my computer unusable for however long it took (which is
_long_), as it kept popping up focus-stealing dialogs about whether or
not I wanted to trust "java" to open an incoming network connection.

The ScenarioService does not seem to have an existing setup for CLI args
and my Scala-fu is not good enough to add one, so I just changed the
hard-coded path.

The JSON API already had an option, just with the wrong default. This is
technically a breaking change, but I'm hoping to pass it under the
"experimental" flag we still have on the JSON API.

CHANGELOG_BEGIN
- [JSON API - Experimental] As a security improvement, the JSON API
server will now bind on ``127.0.0.1`` by default. Previous behaviour was
to bind on ``0.0.0.0``; you can get that behaviour back by passing in
the (existing) flag ``--address 0.0.0.0``.

- [DAML SDK] The Scenario Service will now bind on ``127.0.0.1``. Previous
behaviour was to bind on ``0.0.0.0``.

CHANGELOG_END
2020-03-05 17:10:49 +01:00
Moritz Kiefer
0a6be2b341
Overload submit so that it doesn’t collide with DAML script (#4831)
This introduces a `HasSubmit` typeclass (following the naming scheme
of `HasCreate`, …) and instances for `Scenario` and `Script`. This
avoids the need to hide `submit` in every single DAML script.

changelog_begin

- [DAML Standard Library] ``submit`` and ``submitMustFail`` are now
  overloaded so that they can be used in both scenarios and DAML script.

changelog_end
2020-03-05 15:43:35 +01:00
Moritz Kiefer
42dd6349e9
Cache unmangleIdentifier (#4822)
* Cache unmangleIdentifier

Previously we unmangled once per reference to an identifier rather
than doing the unmangling once per entry in the string interning
table. This PR fixes this which brings a pretty decent performance
improvement. On my testcase the time for converting for converting
from the low-level proto AST to the high-level Haskell AST goes down
from 13.5 to 7.5s on a certain DALF that we know very well. Max
residency also goes down from 2GB to 1.5GB (although that number is
somewhat unreliable ime) and allocations drop by 8%.

changelog_begin
changelog_end

* Move error message to unmangleIdentifier
2020-03-05 13:35:28 +01:00
mergify[bot]
cb1395e923
Remove damlc migrate (#4816)
* Remove damlc migrate

``damlc migrate`` hasn’t worked for quite a while and we emitted a
warning for months so given that we don’t have plans to make it work
again in the near future, I think it does more harm than good to keep
it around.

changelog_begin

- [DAML Compiler] After being deprecated for a while the ``damlc
  migrate`` command has now been removed. See
  https://docs.daml.com/upgrade/ for up to date documentation
  on model upgrades.

changelog_end

fixes #3704 (by removing the tests 😇)

* yeah the windows cache is once again broken \o/

* Revert "yeah the windows cache is once again broken \o/"

This reverts commit 38d7877aa4.
2020-03-04 20:36:48 +00:00
Moritz Kiefer
c866ac5132
Speed up unmangleIdentifier (#4810)
* Speed up unmangleIdentifier

On my (admittedly not super scientific) benchmark, this brings the
time used to convert from the low-level proto Haskell AST to the
high-level AST from 20s down to 16s on a certain DALF that we are all
too familiar with.

changelog_begin
changelog_end

* address review comments
2020-03-04 19:48:03 +01:00
Moritz Kiefer
c6e3bf5399
Only unmangle once in decodeValueName (#4813)
The `decodeValueName` code is rather confusing. It calls things
unmangled that are mangled and the other way around.

Furthermore, it unmangles twice, once in `decodeNameString` and once
directly in `decodeValueName`. The code claims that this is a
compatiblity hack but unless someone can explain to me what exactly is
failing here or CI fails, I would prefer to just kill this.

changelog_begin
changelog_end
2020-03-04 17:29:55 +00:00
Moritz Kiefer
a928402050
Make debug a bit more lazy (#4807)
* Make `debug` a bit more lazy

Previously `debug x >>= f` would print the debug statement when it got
evaluated rather than when the monadic execution got executed. This is
rather confusing. Now we explicitly make it lazy by wrapping the trace
statement in a lambda passed to >>=.

changelog_begin

- [DAML Standard Library] Fix a bug where ``debug`` printed the trace
  statement before the action got executed. Note that this means that
  ``debug`` now has a slightly more restrictive type. You can use
  ``trace`` directly if this causes problems.

changelog_end

* Update compiler/damlc/tests/src/DA/Test/ShakeIdeClient.hs

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-03-04 17:12:24 +00:00
Moritz Kiefer
3c30073b31
Merge cross-LF tests (#4785)
Given that these two group of tests run for the same combination of LF
versions, I don’t see any reason why we should keep them
separate. Merging them, speeds up the packaging tests by > 50s on my
local machine.

changelog_begin
changelog_end
2020-03-03 09:53:06 +00:00
Moritz Kiefer
cc7f3e7ad0
Avoid decoding package twice in validate-dar (#4780)
Rather than decoding everything twice, we can only rewrite references
which is measurably faster (> 5s out of 60s on the packaging tests).

changelog_begin
changelog_end
2020-03-03 10:28:11 +01:00
Moritz Kiefer
ebbe135583
Add singleton to DA.List (#4777)
changelog_begin

- [DAML Standard Library] Add ``singleton`` to ``DA.List``.

changelog_end
2020-03-02 20:49:21 +00:00
Moritz Kiefer
d68d3eb74a
Freeze DAML-LF 1.8 (#4770)
* Freeze DAML-LF 1.8

Two minor points that I did not mention in the previous PR:

We also include the renaming of structural records to `struct` and the
renaming of `Map` to `TextMap`.

There are some minor changes around the LF encoder tests which need to
be able to emit package metadata properly so I’ve added it to the
parser. Sorry for not splitting that out.

Following the process used for the DAML-LF 1.7 release, this does not
yet include the frozen proto file.

changelog_begin

- [DAML-LF] Release DAML-LF 1.8:

  * Rename structural records to ``Struct``. Note that
    structural records are not exposed in DAML.
  * Rename ``Map`` to ``TextMap``.
  * Add type synonyms. Note that type synonyms are not serializable.
  * Add package metadata, i.e., package names and versions.

  Note that the default output of ``damlc`` is stil DAML-LF 1.7. You
  can produce DAML-LF 1.8 by passing ``--target=1.8``.

changelog_end

* Update encoder

* Update java codegen tests

* Update comment in scala codegen

* Handle TSynApp in interface reader

* Bump lf_stable_version to 1.7

* Fix kvutils tests
2020-03-02 18:29:26 +01:00
Moritz Kiefer
501aa9e89e
Prepare DAML-LF 1.8 release (#4769)
We will only include type synonyms and package metadata (which are
used for Cross-SDK model upgrades). Everything else stays in 1.dev for
now.

changelog_begin
changelog_end
2020-03-02 14:23:07 +00:00
Moritz Kiefer
7a9b9a3ace
Fix data-dependencies for impredicative types (#4744)
I’m not really happy with this “fix” but after having spend way too
much time on this, this was the best I came up with. (The details are
in an inline comment). If anyone has better ideas, I’m all ears.

changelog_begin
changelog_end
2020-03-02 09:37:46 +01:00
nickchapman-da
8af3857c09
Use damlc validate-dar in packaging tests. (#4760)
Replace `daml-lf-repl validate` in packaging tests with `damlc validate-dar`.
Simplify test setup a little by passing tools (damlc,validate, etc) in a record.

changelog_begin
changelog_end
2020-02-28 16:28:04 +00:00
nickchapman-da
b8124a993f
damlc validate-dar (#4654)
changelog_begin
changelog_end
2020-02-27 14:26:14 +00:00
Moritz Kiefer
597c3a30f6
Fix unstableDrop (#4740)
We want to start at n not at length - n

changelog_begin
changelog_end
2020-02-27 11:11:57 +01:00
Moritz Kiefer
d455267e58
Reduce the number of GHCs in our nix closure (#4729)
This reduces the number of GHCs to 2 on Linux (regular and DWARF) and
1 on macOS. Given that each derivation is > 1 GB this should hopefully
help a bit.

changelog_begin
changelog_end
2020-02-26 20:00:07 +01:00
Shayne Fletcher
66dd112960
Remove pragma 'daml 1.2' (#4702)
changelog_begin
- The pragma 'daml 1.2' is now optional.
changelog_end
2020-02-26 13:17:45 -05:00
Moritz Kiefer
c9b9293d69
Import all dependencies via Pkg_$pkgid (#4696)
Previously, we mapped `dependencies` under
Pkg_$pkgId.originalmodule name and imported them this way. However, we
did not map `dependencies` the same way. This PR unifies the two and
cleans up the import handling logic a bit.

This also fixes imports if we have two packages with the same name but
a different version since the package name (which is the only thing
usable in package-qualified imports) is not sufficient to
disambiguate. I’ve added a test for this.

changelog_begin
changelog_end
2020-02-26 17:08:41 +01:00
Moritz Kiefer
48acfc3073
Remove daml version headers from packaging tests (#4719)
changelog_begin
changelog_end
2020-02-26 13:04:26 +00:00
Moritz Kiefer
c11a0ebd43
Delete damlc generate-src and damlc generate-gen-src (#4714)
These commands were intended for debugging but neither @associahedron
nor I actually use them since running `daml build` and looking at the
generated files in `.daml` is a much more robust solution.

I’ve also deleted some leftover code from the old-style
data-dependencise where we generated actual template instances (not
just dummy instances). We’ve already deleted everything else around
this, this was just leftover by accident.

The only usage was a testcase which I’ve just switched over to using
`daml build`.

changelog_begin
changelog_end
2020-02-26 11:15:21 +00:00
associahedron
860477bb1f
Handle generic variant records in data-deps. (#4710)
* Handle generic variant records in data-deps.

Fixes issue #4707.

changelog_begin
changelog_end

* Add usage test of problem constructor
2020-02-26 10:52:44 +00:00
Shayne Fletcher
8c36b68a3d
Upgrade to ghc-lib-8.8.1.20200225 (#4692)
- Prelude `daml 1.2` is now optional;
- `HsDumpAst` now comes from `ghc-lib-parser`.

changelog_begin
changelog_end
2020-02-25 14:57:17 -05:00
Gary Verhaegen
5a117dc358
introduce new release process (#4513)
Context
=======

After multiple discussions about our current release schedule and
process, we've come to the conclusion that we need to be able to make a
distinction between technical snapshots and marketing releases. In other
words, we need to be able to create a bundle for early adopters to test
without making it an officially-supported version, and without
necessarily implying everyone should go through the trouble of
upgrading. The underlying goal is to have less frequent but more stable
"official" releases.

This PR is a proposal for a new release process designed under the
following constraints:

- Reuse as much as possible of the existing infrastructure, to minimize
  effort but also chances of disruptions.
- Have the ability to create "snapshot"/"nightly"/... releases that are
  not meant for general public consumption, but can still be used by savvy
  users without jumping through too many extra hoops (ideally just
  swapping in a slightly-weirder version string).
- Have the ability to promote an existing snapshot release to "official"
  release status, with as few changes as possible in-between, so we can be
  confident that the official release is what we tested as a prerelease.
- Have as much of the release pipeline shared between the two types of
  releases, to avoid discovering non-transient problems while trying to
  promote a snapshot to an official release.
- Triggerring a release should still be done through a PR, so we can
  keep the same approval process for SOC2 auditability.

The gist of this proposal is to replace the current `VERSION` file with
a `LATEST` file, which would have the following format:

```
ef5d32b7438e481de0235c5538aedab419682388 0.13.53-alpha.20200214.3025.ef5d32b7
```

This file would be maintained with a script to reduce manual labor in
producing the version string. Other than that, the process will be
largely the same, with releases triggered by changes to this `LATEST`
and the release notes files.

Version numbers
===============

Because one of the goals is to reduce the velocity of our published
version numbers, we need a different version scheme for our snapshot
releases. Fortunately, most version schemes have some support for that;
unfortunately, the SDK sits at the intersection of three different
version schemes that have made incompatible choices. Without going into
too much detail:

- Semantic versioning (which we chose as the version format for the SDK
  version number) allows for "prerelease" version numbers as well as
  "metadata"; an example of a complete version string would be
  `1.2.3-nightly.201+server12.43`. The "main" part of the version string
  always has to have 3 numbers separated by dots; the "prerelease"
  (after the `-` but before the `+`) and the "metadata" (after the `+`)
  parts are optional and, if present, must consist of one or more segments
  separated by dots, where a segment can be either a number or an
  alphanumeric string. In terms of ordering, metadata is irrelevant and
  any version with a prerelease string is before the corresponding "main"
  version string alone. Amongst prereleases, segments are compared in
  order with purely numeric ones compared as numbers and mixed ones
  compared lexicographically. So 1.2.3 is more recent than 1.2.3-1,
  which is itself less recent than 1.2.3-2.
- Maven version strings are any number of segments separated by a `.`, a
  `-`, or a transition between a number and a letter. Version strings
  are compared element-wise, with numeric segments being compared as
  numbers. Alphabetic segments are treated specially if they happen to be
  one of a handful of magic words (such as "alpha", "beta" or "snapshot"
  for example) which count as "qualifiers"; a version string with a
  qualifier is "before" its prefix (`1.2.3` is before `1.2.3-alpha.3`,
  which is the same as `1.2.3-alpha3` or `1.2.3-alpha-3`), and there is a
  special ordering amongst qualifiers. Other alphabetic segments are
  compared alphabetically and count as being "after" their prefix
  (`1.2.3-really-final-this-time` counts as being released after `1.2.3`).
- GHC package numbers are comprised of any number of numeric segments
  separated by `.`, plus an optional (though deprecated) alphanumeric
  "version tag" separated by a `-`. I could not find any official
  documentation on ordering for the version tag; numeric segments are
  compared as numbers.
- npm uses semantic versioning so that is covered already.

After much more investigation than I'd care to admit, I have come up
with the following compromise as the least-bad solution. First,
obviously, the version string for stable/marketing versions is going to
be "standard" semver, i.e. major.minor.patch, all numbers, which works,
and sorts as expected, for all three schemes. For snapshot releases, we
shall use the following (semver) format:

```
0.13.53-alpha.20200214.3025.ef5d32b7
```

where the components are, respectively:

- `0.13.53`: the expected version string of the next "stable" release.
- `alpha`: a marker that hopefully scares people enough.
- `20200214`: the date of the release commit, which _MUST_ be on
  master.
- `3025`: the number of commits in master up to the release commit
  (included). Because we have a linear, append-only master branch, this
  uniquely identifies the commit.
- `ef5d32b7ù : the first 8 characters of the release commit sha. This is
  not strictly speaking necessary, but makes it a lot more convenient to
  identify the commit.

The main downsides of this format are:

1. It is not a valid format for GHC packages. We do not publish GHC
  packages from the SDK (so far we have instead opted to release our
  Haskell code as separate packages entirely), so this should not be an
  issue. However, our SDK version currently leaks to `ghc-pkg` as the
  version string for the stdlib (and prim) packages. This PR addresses
  that by tweaking the compiler to remove the offending bits, so `ghc-pkg`
  would see the above version number as `0.13.53.20200214.3025`, which
  should be enough to uniquely identify it. Note that, as far as I could
  find out, this number would never be exposed to users.
2. It is rather long, which I think is good from a human perspective as
  it makes it more scary. However, I have been told that this may be
  long enough to cause issues on Windows by pushing us past the max path
  size limitation of that "OS". I suggest we try it and see what
  happens.

The upsides are:

- It clearly indicates it is an unstable release (`alpha`).
- It clearly indicates how old it is, by including the date.
- To humans, it is immediately obvious which version is "later" even if
  they have the same date, allowing us to release same-day patches if
  needed. (Note: that is, commits that were made on the same day; the
  release date itself is irrelevant here.)
- It contains the git sha so the commit built for that release is
  immediately obvious.
- It sorts correctly under all schemes (modulo the modification for
  GHC).

Alternatives I considered:

- Pander to GHC: 0.13.53-alpha-20200214-3025-ef5d32b7. This format would
  be accepted by all schemes, but will not sort as expected under semantic
  versioning (though Maven will be fine). I have no idea how it will sort
  under GHC.
- Not having any non-numeric component, e.g. `0.13.53.20200214.3025`.
  This is not valid semantic versioning and is therefore rejected by
  npm.
- Not having detailed info: just go with `0.13.53-snapshot`. This is
  what is generally done in the Java world, but we then lose track of what
  version is actually in use and I'm concerned about bug reports. This
  would also not let us publish to the main Maven repo (at least not more
  than once), as artifacts there are supposed to be immutable.
- No having a qualifier: `0.13.53-3025` would be acceptable to all three
  version formats. However, it would not clearly indicate to humans that
  it is not meant as a stable version, and would sort differently under
  semantic versioning (which counts it as a prerelease, i.e. before
  `0.13.53`) than under maven (which counts it as a patch, so after
  `0.13.53`).
- Just counting releases: `0.13.53-alpha.1`, where we just count the
  number of prereleases in-between `0.13.52` and the next. This is
  currently the fallback plan if Windows path length causes issues. It
  would be less convenient to map releases to commits, but it could still
  be done via querying the history of the `LATEST` file.

Release notes
=============

> Note: We have decided not to have release notes for snapshot releases.

Release notes are a bit tricky. Because we want the ability to make
snapshot releases, then later on promote them to stable releases, it
follows that we want to build commits from the past. However, if we
decide post-hoc that a commit is actually a good candidate for a
release, there is no way that commit can have the appropriate release
notes: it cannot know what version number it's getting, and, moreover,
we now track changes in commit messages. And I do not think anyone wants
to go back to the release notes file being a merge bottleneck.

But release notes need to be published to the releases blog upon
releasing a stable version, and the docs website needs to be updated and
include them.

The only sensible solution here is to pick up the release notes as of
the commit that triggers the release. As the docs cron runs
asynchronously, this means walking down the git history to find the
relevant commit.

> Note: We could probably do away with the asynchronicity at this point.
> It was originally included to cover for the possibility of a release
> failing. If we are releasing commits from the past after they have been
> tested, this should not be an issue anymore. If the docs generation were
> part of the synchronous release step, it would have direct access to the
> correct release notes without having to walk down the git history.
>
> However, I think it is more prudent to keep this change as a future step,
> after we're confident the new release scheme does indeed produce much more
> reliable "stable" releases.

New release process
===================

Just like releases are currently controlled mostly by detecting
changes to the `VERSION` file, the new process will be controlled by
detecting changes to the `LATEST` file. The format of that file will
include both the version string and the corresponding SHA.

Upon detecting a change to the `LATEST` file, CI will run the entire
release process, just like it does now with the VERSION file. The main
differences are:

1. Before running the release step, CI will checkout the commit
  specified in the LATEST file. This requires separating the release
  step from the build step, which in my opinion is cleaner anyway.
2. The `//:VERSION` Bazel target is replaced by a repository rule
  that gets the version to build from an environment variable, with a
  default of `0.0.0` to remain consistent with the current `daml-head`
  behaviour.

Some of the manual steps will need to be skipped for a snapshot release.
See amended `release/RELEASE.md` in this commit for details.

The main caveat of this approach is that the official release will be a
different binary from the corresponding snapshot. It will have been
built from the same source, but with a different version string. This is
somewhat mitigated by Bazel caching, meaning any build step that does
not depend on the version string should use the cache and produce
identical results. I do not think this can be avoided when our artifact
includes its own version number.

I must note, though, that while going through the changes required after
removing the `VERSION` file, I have been quite surprised at the sheer number of
things that actually depend on the SDK version number. I believe we should
look into reducing that over time.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-25 17:01:23 +01:00
Moritz Kiefer
38b7e65197
Add documentation for DAML repl and advertise it (#4678)
* Add documentation for DAML repl and advertise it

This PR adds some simple docs for ``daml repl`` and adds it to the
release notes.

changelog_begin

- [DAML Repl - Experimental] A new ``daml repl`` command that allows
  you to use the ``DAML Script`` API interactively. Take a look at the
  `documentation <https://docs.daml.com/daml-repl/>`_ for more
  information.

changelog_end

* Update docs/source/daml-repl/index.rst

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

* s/Repl/REPL/

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-02-25 11:16:31 +00:00
Moritz Kiefer
76ae5d15a4
Use package metadata instead of file names to infer unit ids (#4667)
* Use package metadata instead of file names to infer unit ids

This PR adds a function that abstracts over whether we get metadata
from a filename (< 1.dev) or directly from the LF metadata.

There is more work to be done here, in particular, I want to clean up
the hacks around daml-prim/daml-stdlib but I’ll leave that for a
separate PR.

changelog_begin
changelog_end

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Util.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* Refactor getUnitId

Co-authored-by: associahedron <231829+associahedron@users.noreply.github.com>
2020-02-24 18:12:29 +00:00
Moritz Kiefer
2a05611b63
Graceful error handling in daml repl (#4673)
* Graceful error handling in `daml repl`

This PR changes `daml repl` to handle errors (parse errors, type
errors, unsupported statement errors, script errors) gracefully
and just emit an error message instead of tearing down the whole
process.

This gets the repl into a state where I think it’s sufficiently
user-friendly to be released (obviously there are tons of potential
improvements). The only thing missing before I’m comfortable
mentioning this in release notes and uninternalizing it are docs.
If you think there is something crucial that needs to be addressed
before, let me know.

changelog_begin
changelog_end

* why is windows
2020-02-24 18:15:32 +01:00
Moritz Kiefer
500fb9a171
Support shadowing in daml repl (#4668)
changelog_begin
changelog_end
2020-02-24 15:47:00 +01:00
Moritz Kiefer
8d81399c0f
Add an experimental DAML script REPL (#4660)
As mentioned in the title, this is still very experimental and needs
more work before we want to advertise it. However, the code is in a
somewhat reasonable shape, there are tests and I think even in the
current state it is already useful. Also this PR is already getting
very large so I don’t want to hold off much longer before merging this.

It is included in the SDK but hidden from `damlc --help` and `daml
--help` until the most pressing issues are addressed (primarily around
making sure that it doesn’t just shut down if you have a type error
and better error messages in general).

changelog_begin
changelog_end
2020-02-24 11:06:27 +01:00
Martin Huschenbett
b38ec15e3a
Add hlint rule to use whenJust instead of maybe (pure ()) (#4659)
This has come up a few times lately.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-24 10:08:44 +01:00
Remy
0321a1bb32
[Engine] push absolute contract ids inside the evaluation (#4652)
* [Engine] push absolute contract inside the evaluation
* Remove discriminator fom relative contract id

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 20:21:35 +01:00
Moritz Kiefer
c68dd19ade
Decode and validate package metadata in Scala (#4653)
This adds the code for decoding and validating package metadata
that is now emitted by damlc.

changelog_begin
changelog_end
2020-02-21 18:20:42 +00:00
Moritz Kiefer
c03ded317b
Produce package metadata in damlc (#4647)
This PR adds the necessary infrastructure to produce package metadata
in `damlc`.

For `damlc build` this works exactly as expected. There are a few edge
cases where we don’t have names and/or versions (namely scenarios,
damlc compile and damlc package). We don’t really care about the
metadata for those anyway, so I’ve just set it some default value.

changelog_begin
changelog_end
2020-02-21 13:47:28 +01:00
Moritz Kiefer
fb30690787
Clarify optionality of pVersion field in PackageConfig (#4648)
changelog_begin
changelog_end
2020-02-21 11:58:32 +00:00
Martin Huschenbett
19e1973b29
Improve documentation of DA.Text.sha256 (#4649)
This was suggested on the public slack. Easy enough to fix it quickly.

changelog_begin
changelog_end
2020-02-21 11:48:52 +00:00
Moritz Kiefer
fe6b710329
Typify splitUnitId (#4643)
Strings are confusing so let’s throw in some more types.

changelog_begin
changelog_end
2020-02-21 10:26:16 +01:00
Moritz Kiefer
a252605d91
Refactor handling of package names and versions (#4633)
* Refactor handling of package names and versions

This is a preparatory refactoring PR in preparation for propagating
package metadata into DAML-LF. There are no actual changes in here.

Primarily the changes consist of 3 things:

1. In options, we split the `optMbPackageName` field which previously
contained the unit id into `optMbPackageName` and
`optMbPackageVersion`.
2. We use newtypes for names and versions and try to keep them pretty
much everywhere (the only place missing is `splitUnitId`, I’ll do that
separately).
3. We use `UnitId` where we want `name-version`.

As was probably to be expected, this surfaced some minor issues. They
are pretty much exclusively in debugging or “internal” commands so
I’ve mostly just added notes/todos.

changelog_begin
changelog_end

* cry about applicativedo
2020-02-20 17:57:35 +00:00
Remy
3a8139d9c1
Engine: move partialTransaction to interpreter (#4617)
* Engine: move partialTransaction to interpreter

CHANGELOG_BEGIN
CHANGELOG_END

* formating

* fix
2020-02-20 16:48:47 +00:00
Moritz Kiefer
c1a2569481
Add subtractDays to the standard library (#4618)
`addDays d (- r)` looks a bit confusing and it’s not obvious that
negative numbers even work.

changelog_begin

- [DAML Standard Library] Add `subtractDays` to the DAML Standard Library.

changelog_end
2020-02-20 12:23:18 +00:00
Moritz Kiefer
88330c9ced
Add package metadata to DAML-LF proto and the Haskell AST (#4616)
* Add package metadata to DAML-LF proto and the Haskell AST

This adds package metadata (currently only the package name and
version) to DAML-LF and the corresponding Haskell ASTs. This is useful
for debugging and “codegens” (typescript, damlc dependencies, …)

This PR does not yet add it to the Scala side or change the compiler
to actually produce this metadata.

Part of #4412

changelog_begin
changelog_end

* Address review comments
2020-02-20 12:08:27 +00:00
associahedron
5db4ac8b0e
Support type-level strings in DAML. (#4571)
* Add type-level strings in DAML.

This PR adds a `PromotedText` stable package, with `PromotedText` type, which is used to encode type-level strings from DAML into DAML-LF. The reason for this is to preserve the `HasField` instance argument. This PR adds a test that `HasField` is succesfully reconstructed incontexts, during data-dependencies, which wasn't possible before.

changelog_begin
changelog_end

* adresss comments

* fix overly specific tests
2020-02-19 13:10:36 +00:00
Jussi Mäki
61a65fe16f
Use the contract key hasher in kvutils (#4542)
* Use KeyHasher to serialize contract keys in kvutils

- Use Value instead of VersionedValue in GlobalKey as the versioning does not make sense here
  and may be misleading as the a value with a different version but same meaning would still
  be the same key.

- Relocate the KeyHasher to ledger-api-common so kvutils can use it (otherwise cyclic dependencies)

- Replace storing of the contract key as a VersionedValue with the hash produced by KeyHasher.
  This is backwards incompatible. A compatible option would require us to query the key with both
  the old way and the new way which is unattenable. We're making a calculated breaking change.

CHANGELOG_BEGIN
- [DAML Ledger Integration Kit] Serialize contract keys using a hash instead of the value in kvutils.
  This is a backwards incompatible change to kvutils.
CHANGELOG_END

* Use proper hasher for contract keys and not KeyHasher

- Use Hash.scala, not KeyHasher.scala.
- Add hash to GlobalKey as we want the hash to be computed from the inside.
  The use of KeyHasher will be later deprecated and replaced by this.

* Use "sealed abstract case class" trick instead of private ctor

and rebase fix

* Revert change to unsupported value version decode error

* Reformat code

* Add kvutils changelog entry and bump the version
2020-02-19 11:56:31 +00:00
Martin Huschenbett
562708fd93
Make DAML's (>>) operator lazy in its second argument (#4552)
* Make DAML's (>>) operator lazy in its second argument

Currently, when you write
```haskell
do
  Left "wanted"
  error "unwanted"
```
your computation fails with an exception coming from the `error "unwanted"`
call. However, `do`-notation suggests that you actually never get there but
rather bail out at the `Left "wanted"` line. The cause of this mismatch is
that GHC desugars the code above to
```haskell
Left "wanted" >> error "unwanted"
```
and since DAML is strict, we evaluate `error "unwanted"` _before_ evaluating
the application of `(>>)`.

This PR solves the problem by rewriting all expressions of the form `A >> B`,
and hence those of the form `do A; B` as well, to `A >>= \_ -> B`. This gives
the desired semantics with `(>>)` being lazy in its second argument.

However, these semantics only make sense for `Action`s (aka monads). Thus, we
need to restrict the constraint on `(>>)` from `Applicative` to `Action`.
(This is in line with what Haskell does.)

Moreover, the `Action` instance of the `Validation` applicative would lead
to undesriable behavior when using `do`-notation. Thus, we also drop this
`Action` instance and hence force the usage of the `ApplicativeDo` language
extension when using `do`-notation for `Validation`.

CHANGELOG_BEGIN

- [DAML Stdlib] Restrict the ``(>>)`` operator to instances of ``Action``
  and make it lazy in its second argument. This gives expressions of the
  form ``do A; B`` the desirable semantics of only running ``B`` when
  ``A`` is a successful action.
- [DAML Stdlib] Remove the ``Action`` and ``ActionFail`` instances for
  ``Validation`` in ``DA.Validation``. Please enable the ``ApplicativeDo``
  language extension if you want to use ``Validation`` with ``do``-notation
  and replace ``fail`` with ``DA.Validation.invalid``.

CHANGELOG_END

* Address @cocreature's remarks

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-18 14:12:47 +00:00
Moritz Kiefer
611b037f55
Fix handling of duplicate instances (#4562)
We forgot to import the module that defines the duplicate instance
which causes problems if this instance is required for something else,
e.g. because it is a superclass of another instance.

This fixes the issue surfaced by the removal of the Action instance
for Validation in #4552.

changelog_begin
changelog_end
2020-02-18 13:14:42 +00:00
nickchapman-da
be85070949
make --hide-all-packages the default and always behaviour (#4391)
changelog_begin
changelog_end
2020-02-18 11:54:09 +00:00
Moritz Kiefer
ab74291f0a
Use decodeArchivePackageId where possible (#4550)
Shouldn’t really make a difference due to laziness but at least it
makes it explicit if we need to decode the archive to the AST or just
need to get the package id.

changelog_begin
changelog_end
2020-02-18 09:12:35 +01:00
Moritz Kiefer
b577f8425d
Short circuit package db initialization (#4547)
On a simple quickstart project we spend about 0.7s in
createProjectPackageDb (all of it in the `withDamlIdeState`
part). This slows down our packaging tests significantly so for now
I’ve added some shortcircuiting if we don’t have any deps and
data-deps. We might want to find a nicer solution here in the
future but the whole code for setting up the package db is going to
move a around a fair bit so I don’t think it makes sense to do this
right now.

changelog_begin
changelog_end
2020-02-17 15:33:08 +00:00
Moritz Kiefer
4c7a864d3b
Make context updates in the scenario service thread safe (#4539)
I don’t have a great test case to demonstrate the problem but
`contexts = contexts + (ctxId -> ctx)` is definitely not an atomic
update which means that inserts can get lost.

changelog_begin
changelog_end
2020-02-17 12:35:51 +00:00
Moritz Kiefer
cc4f1430fb
Fix flaky lsp tests (#4541)
I’ve failed to reproduce this locally so far but on CI we sometimes
get the DLint warning that `True == True` is redundant before we get the
parse error which results in the tests failing. There is no reason why
we need to use `True == True` here anyway so the fix is to simply
replace it by `True`.

changelog_begin
changelog_end
2020-02-17 12:50:53 +01:00
Moritz Kiefer
a0df5f91f9
Fix race condition in scenario service context updates (#4537)
If we get interrupted after updating our local view but before doing
the actual context update on the server side bad things happen. To fix
this, we first clone the context then update the clone which avoids
this and is a bit nicer than throwing an `uninterruptibleMask` around
updating the local view and sending the updateCtx gRPC request.

fixes #4525

changelog_begin
changelog_end
2020-02-17 11:57:45 +01:00
Moritz Kiefer
549caa6fd3
Fix cross-sdk typeclass reexports in data-dependencies (#4517)
* Fix cross-sdk typeclass reexports in data-dependencies

Sorry for the somewhat large PR, the intermediate states sadly just
change error messages but don’t allow me to test the things they
enable (at least not without considerable effort).

There are a few things this PR fixes:

1. We did not properly expose `dependencies` while compiling
   `data-dependencies`. Now they are mapped under a Pkg_$pkgId prefix.
2. We did not pass on `dependencies` to the LF typechecker and
   various other places that tried to look up LF packages.
3. We did not filter out duplicate instances, e.g., `daml-prim`
   defines `Eq` instances for `Either`. If we define that twice, we
   will get an error.
4. The use of Generic in DA.Upgrade doesn’t work
   (https://github.com/digital-asset/daml/issues/4470). For now,
   I’ve added a somewhat crude hack to filter out typeclasses of a
   given name. We should replace this by checking for `Erased`
   but that is not yet used in 0.13.51 which I use in the test.

For the test, I’ve checked in a DAR built on 0.13.51 with DAML-LF
1.dev. Not sure if checking in DARs is a reasonable thing to do in the
long term but for now, this is small enough and let’s us move forward
with this.

changelog_begin
changelog_end

* Document envDepInstances

* Document TUnit match

* Update docs for stub binds

* Cleanup and document class rewrites
2020-02-14 17:00:52 +01:00
associahedron
d9cb5099de
A first draft at telemetry for daml-assistant. (#4506)
* Report assistant commands and errors via a logger.

CHANGELOG_BEGIN
CHANGELOG_END

* Hook up daml-assistant to a GCP logger.

* fix test case

* fix more tests

* Check opted in status in assistant.

* Anonimize args that have unexpected characters.

* More agressive anonimization

* add missing containers dependency
2020-02-14 15:46:25 +00:00
Moritz Kiefer
7124479647
Add subtract to the daml-stdlib (#4523)
changelog_begin

- [DAML Standard Library] Add a ``subtract`` function which is useful
  as a replacement for sections of ``(-)``, e.g., ``subtract 1`` is
  equivalent to ``\x -> x - 1``.

changelog_end
2020-02-14 13:55:47 +00:00
Moritz Kiefer
b386f07588
Mark Shake tests as flaky (#4526)
changelog_begin
changelog_end
2020-02-14 13:31:50 +00:00
Moritz Kiefer
1fce415359
Only extract main dalf from a dependency (#4515)
This is a spin off from my fixes for making data-deps work with
typeclasses cross-SDK.

We only have the interface files for the main dalf so it doesn’t
really make sense to extract the other dalfs. The current behavior of
extracting all dalfs results in them being picked up by
`GeneratePackageMap` even if GHC doesn’t know about them which causes
issues in other placse.

I’ve adapted the collision check to check for transitive dependencies
when creating the project db.

changelog_begin
changelog_end
2020-02-14 13:33:48 +01:00
Moritz Kiefer
6b9c0407c7
Fix error messages on incorrect --package flags (#4516)
The string needs to include the full flag instead of only including
--package. Otherwise you get rather unhelpful error messages.

changelog_begin
changelog_end
2020-02-14 10:36:29 +01:00
Moritz Kiefer
73f60a44cb
Wrap -> kind in parentheses in data-dependencies (#4492)
Previously we translated (* -> *) -> * -> * to * -> * -> * -> *
which breaks things like MonadTrans.

changelog_begin
changelog_end
2020-02-12 14:41:14 +00:00
Moritz Kiefer
8b512d9212
Handle multiple constraints on an instance in data-dependencies (#4490)
* Handle multiple constraints on an instance in data-dependencies

Previously we translated `instance (Foo a, Foo b) => Foo (a, b) where`
into `instance Foo a => Foo b => Foo (a, b)` which is a syntax
error. We already did this correctly for `HasField` so this PR mostly
just shuffles things around to always use the non-HasField specific
parts.

changelog_begin
changelog_end

* Prefix fields of DFunHead wtih dfh
2020-02-12 13:54:43 +00:00
Moritz Kiefer
1721e12f64
Wrap function types in parentheses for data-dependencies (#4488)
This fixes a bug where `data X = X (a -> b)` was reconstructed as
`data X = X a -> b` which is a syntax error.

changelog_begin
changelog_end
2020-02-12 14:02:02 +01:00
Moritz Kiefer
4e3cad411b
Extend LSP multi-package tests (#4481)
This adds a test for running the LSP server directly in the project
directory to make sure that we do not need to build first in that case
and that no --package flags are necessary.

changelog_begin
changelog_end
2020-02-12 10:21:01 +01:00
Moritz Kiefer
36e188cac8
Translate unsupported kinds to a special Erased type (#4474)
* Translate unsupported kinds to a special Erased type

This should simplify `data-dependencies` and avoid issues like #4470
since we can match on the type instead of having to guess which types
can and which cannot be translated back to DAML.

changelog_begin
changelog_end
2020-02-12 09:03:19 +01:00
Moritz Kiefer
943b43066f
Switch to HashSet/HashMap for NormalizedUri/NormalizedFilePath (#4468)
* Switch to HashSet/HashMap for NormalizedUri/NormalizedFilePath

This matches the change to ghcide in
https://github.com/digital-asset/ghcide/pull/420. Now that we have
optimized Hashable instances it makes sense to use them as much as
possible.

changelog_begin
changelog_end

* debug windows crap

* Fix a bug in vr scenario notifications

* Revert "debug windows crap"

This reverts commit f58fdb92c1.

* attempt to fix windows

who are we kidding, this is not going to work
2020-02-11 15:02:11 +00:00
Moritz Kiefer
730da9e332
Handle references to Any in data-dependencies (#4469)
changelog_begin
changelog_end
2020-02-11 14:54:03 +01:00
Moritz Kiefer
1dc40ca239
Support multiple-packages in damlc ide (#4445)
* Support multiple-packages in `damlc ide`

changelog_begin

- [DAML Studio] You can now open DAML Studio in the root of a
  multi-package project instead of opening it separately for each
  package. Take a look at the documentation for details on how to set
  this up.

changelog_end

There are a few caveats here:

1. You need a ``daml.yaml`` in the root of your project directory. I
think this is somewhat sensible but we should add a warning to VSCode
if you open it in a directory that does not have a ``daml.yaml`` (in a
separate PR).

2. Changes are not picked up accross dependencies. This is a larger
undertaking and given the current setup simply impossible (we don’t
know that the source files of one package belong to the DAR referenced
in the ``dependencies`` field of the other package. We can make this a
bit better by at least detecting that the ``.dar`` has changed but
let’s do that separately.

3. Since ``daml init`` runs once on startup, it will run in the root
directory instead of initializing the package db of the individual
packages. This is fixable but will conflict with #4391 so let’s
address this separately.

I’ve added docs to the daml studio section that explain the caveats.

* Use the proper sdk version in lsp-tests
2020-02-10 12:20:56 +00:00
Moritz Kiefer
095cf9732a
Remove dependency on ghcide’s fakeDynFlags (#4456)
`fakeDynFlags` has been removed from ghcide. We still need it since we
set up our environment in weird ways and want it to be platform
independent so this PR just copies the definition into `daml`.

changelog_begin
changelog_end
2020-02-10 12:30:37 +01:00
Moritz Kiefer
023c532399
Disable debouncer in the CLI compiler (#4438)
This should hopefully fix the lost diagnostics in our packaging tests.

changelog_begin
changelog_end
2020-02-06 21:13:52 +00:00
Shayne Fletcher
44fe69c2f0
Disable list comprehension hints (#4435)
changelog_begin
changelog_end
2020-02-06 18:36:31 +00:00
Moritz Kiefer
26f8f9f726
Fix flaky packaging tests (#4433)
We need to use runActionSync everywhere except for the IDE.  Pretty
sure I’ve fixed all cases of those. We also need to use useE instead
of use_ since apparently exceptions shortcircuit shake meaning that
runActionSync doesn’t actually do sync. I’ve only fixed the cases that
we hit in the tests so we probably should do a more thorough pass
after this (I want to get this merged soon since it is quite flaky on
master).

changelog_begin
changelog_end
2020-02-06 18:06:12 +00:00
associahedron
65aa1fd889
Start dealing with TyConAppCo coercions for GeneralizedNewtypeDeriving. (#4428)
* Add tyconappco coerceion test

* Start dealing with TyConAppCo coercions

changelog_begin
changelog_end
2020-02-06 15:03:29 +00:00
associahedron
c688289de2
Add checks for unit id conflicts. (#4421)
* Added checks for unit id conflicts.

changelog_begin
changelog_end

* Only report conflicting keys

* lint

* fix indentation

* Show conflicting package ids also
2020-02-06 15:01:52 +00:00
Moritz Kiefer
45f19f4255
Mark packaging tests as non-flaky (#4429)
I’ve spend several hours trying to get them to fail on Linux and
Windows and have failed completely (apart from making my machine roun
out of memory, thanks crashplan). I also inserted explicit delays to
make the failure more often frequent without any sucess (at making it
fail). I don’t really have a satisfying explanation of why this is
gone now. My best guess is that the `ghcide` upgrade fixed this since
it included some fixes and changes around how we kill and start the
shake process.

fixes #4328

changelog_begin
changelog_end
2020-02-06 14:59:54 +00:00
Gary Verhaegen
47bd131f15
add copyright headers to yml files (#4407)
We seem to have forgotten about them in the copyright scripts.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-06 12:54:07 +01:00
Jussi Mäki
f0c4f2820c
Add NodeInfo and informeesOfNode method. Fix witnesses of top-level fetches. (#4217)
This adds the NodeInfo trait to compute the informees of a node and the
required authorizers. This has been separated into its own trait as this
computation is also required (externally) for serialized transaction nodes
in a context where the full deserialization of the node would be prohibitively
expensive.

While doing this change and cleaning up transaction authorization it was
discovered that top-level fetches (which can only be created from scenarios)
did not include the submitter as a witnessing party.

CHANGELOG_BEGIN
[DAML SDK] Fix computation of witnesses of top-level fetch nodes in scenario results ("known to").
CHANGELOG_END
2020-02-05 14:17:32 +00:00
associahedron
5190d65d3b
Add a test for template typeclass instances (#4408)
changelog_begin
changelog_end
2020-02-05 14:11:07 +00:00
Moritz Kiefer
4582ef7060
Extend telemetry data to log when users ignored the telemetry popup (#4403)
Previously, we did not send any message when users simply clicked away
the telemetry popup. Now we send a special message similar to the
opt-out message which only includes the machine id.

I’ve also changed the opt-out message to include the machine id.

changelog_begin
changelog_end
2020-02-05 14:14:48 +01:00
Rohan Jacob-Rao
fcab7d1a0f
Remove '.' from output of daml build (#4392)
* Space

* Factor out createDarFile

* Remove frustrating full stop

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-04 23:44:56 +00:00
Moritz Kiefer
52d4f60aec
Switch to ghcide 0.1.0 (#4381)
* Switch to ghcide 0.1.0

changelog_begin
changelog_end

* Bump hie-bios
2020-02-04 18:40:43 +01:00
associahedron
248e31e46a
Expose HasField instances in data-dependencies. (#4377)
* data-dependencies: Expose HasField instances

changelog_begin
changelog_end

* Add test
2020-02-04 15:10:55 +00:00
associahedron
159d828040
daml-dependencies: Use a safer safeToReexport (#4353)
* Use a safer safeToReexport

This is much safer than the approximation from last time. The only downside is
introducing a dependency between data dependencies and our type checker,
but that seems safer than having two versions of `expandTypeSynonyms`
floating around (and perhaps this dependency is something we would end
up adding anyway).

changelog_begin
changelog_end

* Add own package to extPackages.

* Use mkTForalls

* simplify mkTForalls
2020-02-03 19:11:11 +00:00
Remy
06967d80fa
Engine: scenario runner prefixes fresh nodeIds and contractIds with #
CHANGELOG_BEGIN
CHANGELOG_END
2020-02-03 14:43:53 +01:00
associahedron
bdd41067dc
Re-export typeclasses in data-dependencies whenever possible. (#4336)
* Re-export typeclasses in data-dependencies...

... whenever possible.

The `safeToReexport` over-approximation is simple but troubling, so
I'd like to get it fixed soon.

The inputs to generateSrcFromLfPkg (and the genInstances one) were
getting quite hairy, so I decided to pass a record instead.

changelog_begin
changelog_end

* Add a test

* Move generateSrcPkgFromLf to its original place

* Better docs and make envQualify more clear

* compute dependency ids in generate-src command
2020-02-03 12:47:07 +00:00
Moritz Kiefer
0201055f80
Move damlc test tests out of packaging tests (#4332)
The packaging tests are already one of our slowest test suites and
damlc test takes quite a while since it has to spin up the scenario
service.

We already have tests for damlc tests so this PR moves the tests from
the packaging test suite that are specific to `damlc test` to those
tests which should balance things a bit better.

changelog_begin
changelog_end
2020-01-31 18:39:43 +01:00
associahedron
9ae41c6c84
Generate empty stub instances in data-dependencies (#4331)
Based on a comment by @cocreature in the last PR, this PR changes the
generation of typeclass instances to empty stubs, instead of adding
stub methods as well.

changelog_begin
changelog_end
2020-01-31 16:23:25 +00:00
Moritz Kiefer
ea0bf33c1c
Mark packaging tests as flaky (#4329)
Sadly my fix in https://github.com/digital-asset/daml/pull/4325 didn’t
seem to work (despite fixing the issue in my tests) so let’s mark this
as flaky until we figure it out.

changelog_begin
changelog_end
2020-01-31 15:00:25 +00:00
associahedron
132695e599
Expose instances in data-dependencies. (#4326)
* Expose instances in data-dependencies

changelog_begin
changelog_end

* Add a direct instance import test.
2020-01-31 14:20:09 +00:00
Moritz Kiefer
6a8f4aef6f
Ensure that diagnostics in buildDar are not lost (#4325)
We have seen a couple of flaky tests runs on CI in the packaging test
caused by this. It is easy to reproduce if you add a delay in
diagnosticsLogger before printing the diagnostics which makes this
failure reproducible. With this patch, the diagnostics are always
printed even with a delay.

changelog_begin
changelog_end
2020-01-31 14:00:53 +00:00
Moritz Kiefer
0f070ff34e
Remove mkOptions and defaultOptionsIO (#4323)
* Remove mkOptions and defaultOptionsIO

`mkOptions` is a terrible API and this PR burns it with lots of 🔥.

The only thing that I didn’t simply move around is the validation
logic in `mkOptions` which validates that some directories
exist. Given that I’ve never actually see this be useful and the
options to set these directories (package dbs, import paths) are
internal I don’t think we actually gain anything from this.

I’ve also killed defaultOptionsIO which was a very confusing wrapper
around `mkOptions` that in addition to calling `mkOptions` also
enabled DLint. This was only used in tests, so I’ve enabled DLint in
the tests that need this.

changelog_begin
changelog_end

* newtype version header
2020-01-31 13:39:54 +00:00
associahedron
a69528fab4
Generate module references at the same time as conversion. (#4274)
* Generate mod refs at the same time as conversion

* Small change

changelog_begin
changelog_end

* lint

* Get rid of secondM

* Switch to Writer.CPS

* doc typo
2020-01-31 12:26:31 +00:00
Tamás Kálcza
64864d9d9c
Partition function to prelude (#4318)
* Added a partition function to prelude.

* Fixed partition function documentation.

* CHANGELOG_BEGIN
- Added `partition` function to prelude.
CHANGELOG_END

* Fixed partition documentation.
2020-01-31 12:20:50 +01:00
Moritz Kiefer
65fc65ffa8
Factor out logic from mkOptions (#4319)
This is purely a refactoring in preparation of killing `mkOptions`
completely.

changelog_begin
changelog_end
2020-01-31 11:11:18 +00:00
Moritz Kiefer
104376ac65
Pass uninitialized mkOptions to initPackageDb (#4291)
`initPackageDb` assumes that `Options` has not yet been initialized
and calls `mkOptions` itself. Each call to `mkOptions` appends the LF
version to the package db dir which means that calling it twice as we
did in `execIde` results in pkg dbs of the form dir/1.7/1.7 which is
obviously not what we want.

This is just the fix, I’m sufficiently annoyed by this now, that I’ll
spend some time tomorrow to kill mkOptions completely but for now this
at least fixes the SDK on master.

The reason why we didn’t catch this in our tests is that the package
dbs are located slightly differently via Bazel runfiles as they are
located in the final release tarball which ended up not breaking this
in our LSP tests.

changelog_begin
changelog_end
2020-01-30 19:14:16 +00:00
Shayne Fletcher
a48b7b039f
Update hlint (#4276)
* Update hlint

changelog_begin
changelog_end

* Update hlint

changelog_begin
changelog_end
2020-01-30 00:06:18 +00:00
Samir Talwar
4d324f6aaf
Run scalafmt on all files and fix the errors. (#4260)
Unfortunately, downgrading `scalafmt` resulted in files that would be
reformatted to invalid code, because lines would be merged but trailing
commas would be left in.

I've manually run it everywhere and fixed these issues so people don't
have to fix them as they go.

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-29 16:15:49 +00:00
Stefano Baghino
87b4917ccf
Run scalafmt to reduce noise on #4217 (#4245)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-29 10:18:56 +01:00
associahedron
a8343e62c6 Refactor ModRef out as a type. (#4251)
* Refactor modrefs out as a type.

This is in preparation for moving to a monadic style.

changelog_begin
changelog_end

* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/DataDependencies.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-28 18:17:49 +00:00
associahedron
aeaf3ceab7
Export typeclasses in data-dependencies. (#4247)
* Typeclass declarations

* Add modrefs for typesyns

changelog_begin
changelog_end

* Convert constraints and expose methods using them
2020-01-28 16:44:54 +00:00
Martin Huschenbett
d568c113df
damlc: Allow all build options for damlc ide (#4213)
Currently, the DAML language server use for DAML Studio crashes when the
`build-options` section of `daml.yaml` contains flags like `--package`.
This PR fixes this issue by allowing most of the flags for `damlc build`
for `damlc ide` as well.

CHANGELOG_BEGIN

- [DAML Studio] Allow all command line flags for ``daml build`` for
  DAML Studio as well.

CHANGELOG_END
2020-01-28 17:22:02 +01:00
Andreas Herrmann
74984559e8 Test triggers in scenarios (#4233)
* Bazel test for trigger scenario

* daml-triggers: Allow testing trigger rules in scenarios

CHANGELOG_BEGIN
- [DAML Triggers - Experimental] DAML triggers can now be tested in
scenarios. Specifically, a trigger's ``rule`` can be executed in a
scenario and assertions performed on the emitted commands.
CHANGELOG_END

* Allow assertions on create commands

CHANGELOG_BEGIN
* [DAML stdlib] Add `CanAbort` instance for `Either Text`.
CHANGELOG_END

* Add convenience to construct ACS for testRule

* Add assertions for exercise and exerciseByKey

* fix assert message

* Test assertExercise(ByKey)Cmd

* unpackCommands --> flattenCommands

* Add API documentation

* Document that command ids start from "0"

* generalise command assertions to CanAbortm

* export ACSBuilder type

* Better haddocs for trigger command assertions

* explicit let

* ./fmt.sh

* Fix runfiles on Windows

* Add reference to Bazel issue

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-28 11:50:46 +00:00
Moritz Kiefer
54ace2ce06 Initialize package db in damlc test (#4240)
fixes #3436

changelog_begin

- [DAML Compiler] ``damlc test`` now initializes the packagedb automatically which
  means that it will work on projects that declare custom
  ``dependencies`` in ``daml.yaml`` without having to call ``damlc
  init`` first.

changelog_end
2020-01-28 11:22:25 +00:00
associahedron
02b531d254 Preserve class method names during LF conversion. (#4230)
* Preserve class method names during LF conversion.

This PR changes the LF conversion to pick names for dictionary
fields that will be easier to reconstruct as typeclasses
later.

For superclasses this uses "s_1", "s_2", "s_3" and so on,
and for methods this uses "m_foo", "m_bar", "m_baz" and
so on. (Is this enough C++?)

In the future we might want to distinguish between methods
that are mandatory and methods that are optional ... but
I think this should be good enough for now.

This PR also adds a test.

Fixes #4216

changelog_begin
changelog_end

* lint

* Run test in LF 1.7 as well

* Add test for superclass field.
2020-01-28 10:55:02 +00:00
Moritz Kiefer
8a67aff8de Remove position-mapping tests (#4238)
They have been migrated to `ghcide` in
https://github.com/digital-asset/ghcide/pull/388 which is a much more
sensible place for them to live given that the code is in that repo.

changelog_begin
changelog_end
2020-01-28 10:08:15 +00:00
Moritz Kiefer
3245a7b587 Fail when a data-dependency fails to compile (#4219)
* Fail when a data-dependency fails to compile

Previously, we emitted errors but just kept on going which sometimes
kinda works but is certainly not the right thing to do.

Now we just crash and abort compilation.

changelog_begin
changelog_end

* why is windows

* undo crap
2020-01-27 15:25:47 +00:00
Moritz Kiefer
40292c2b6d
Avoid including daml-stdlib and daml-prim twice (#4222)
This fixes #4114 and cleans up the situation around
`data-dependencies` and `dependencies` as described in #4218.

There is still more work to be done here mostly around ironing out all
the edge cases and producing useful error messages instead of
silentely doing the wrong thing but I’ll leave that to a separate PR.

To test this, I’ve fixed the packaging tests to no longer deduplicate
package ids (which means they would return the wrong number if
daml-prim ends up in there twice) and I addded a test where we have 3
projects:

- `lib`
- `a` which depends on `lib`
- `b` which depends on `lib` via `dependencies` and 'a' via
  `data-dependencies`.

changelog_begin
changelog_end
2020-01-27 14:56:12 +01:00
associahedron
830c2c65f5 Add missing CurrentSdk prefixes in data-dependencies (#4220)
* Expose scenarios in data-dependencies.

Also add some type signatures.

changelog_begin
changelog_end

* Add missing prefixes in data-dependencies
2020-01-27 12:57:35 +01:00
associahedron
3c93b5e6c9
Converting functions in data dependencies. (#4182)
* Converting functions in data dependencies.

changelog_begin
changelog_end

* Add NoOverloadedStrings to the set of extensions in generated packages.

* Just use the fn as its own right hand side

* Restore order of package map (not that it makes a difference)

* Adjust imports

* Weird lint but ok

* Make the test pass somehow

* Dont preprocess enums in GHC.Prim

* Preprocess enums everywhere, and add mod ref as needed.

* Revert preprocessor changes

* Dont expose old-style typeclasses

* Dont convert newstyle typeclasses temporarily either

* Add test for function importing
2020-01-27 10:05:00 +00:00
Moritz Kiefer
3496ce03a4 Convert type classes to LF type synonyms (#4023)
changelog_begin
changelog_end
2020-01-24 09:24:45 +00:00
Moritz Kiefer
93d7b1a472 Bump ghcide to fix GHC panics in LSP tests (#4176)
fixes #4152

changelog_begin
changelog_end
2020-01-24 08:40:57 +00:00
nickchapman-da
62d592ec62
support type synonyms in scala (#4101)
* Support DAML-LF type synonyms in scala.

CHANGELOG_BEGIN
CHANGELOG_END

* dont create synonymns in GenerateSimpleDalf

* extend DAML-LF parser to support type synonyms

* test: expand type synonyms correctly
2020-01-23 10:49:28 +00:00
Shayne Fletcher
e9d67ba9f6
Disambiguate consuming vs pre-consuming choices (#4164)
changelog_begin
- [DAML Compiler] Choices marked explicitly as `preconsuming` are now equivalent to a non-consuming choice that calles `archive self` at the beginning.
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-22 14:24:00 -05:00
Remy
b6e848b576
Engine: Add node and contract Discriminator
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-22 18:49:30 +01:00
Moritz Kiefer
2fb107b505 Remove damlc.jar (#4157)
* Remove damlc.jar

We never advertised or published this externally and our only internal
user has moved off this months ago already.

changelog_begin
changelog_end

* Remove dependency from navigator test lib on damlc jar
2020-01-22 16:44:27 +00:00
Moritz Kiefer
57d0e32c3e
Mark lsp-tests as flaky (#4158)
This makes me a :sadpanda: but until we have figured out what is going
on, this seems better than forcing manual restarts.

changelog_begin
changelog_end
2020-01-22 16:55:44 +01:00
Shayne Fletcher
674eaffc70
Depend on ghc-lib-parser-ex (for hlint) (#4109)
changelog_begin
changelog_end

Co-authored-by: Shayne Fletcher <shayne.fletcher@digitalasset.com>
2020-01-22 06:25:51 -05:00
Moritz Kiefer
19dd7ed7c4 Handle unserializable scenario result types (#4156)
* Handle unserializable scenario result types

Previously, the conversions made some attempt at guarding against this
by matching on SPap and PClosure. While it would be possible to extend
this to match on STypeRep, this doesn’t actually fix the issue since
this can be nested, e.g., you can have a record with a field that is
an SPAP.

This PR changes this to simply catch any errors thrown from
`toValue`. While this feels a bit ugly, I think it’s a reasonable fix
for now.

changelog_begin

- [DAML Studio] Scenarios with unserializable result types no longer
  crash the scenario service.

changelog_end

* Only run test on DAML-LF >= 1.7
2020-01-22 11:15:46 +00:00
Moritz Kiefer
8d7c021001 Remove intermediate PackageImport type (#4142)
* Remove intermediate PackageImport type

We can just reuse GHC’s PackageFlag directly which simplifies things a
bit.

changelog_begin
changelog_end

* windows is bad

* meh

* foobar

* why
2020-01-21 20:27:26 +00:00
Moritz Kiefer
359e5c350c
Fix enums in data-dependencies (#4143)
To differentiate between "data X = X" which is translated to a DAML-LF
enum and "data X = X {}" which is translated to a DAML-LF record, we
add a datatype context with GHC.Types.DamlEnum. For
`data-dependencies` this needs to point to Currentsdk.GHC.Types.

changelog_begin
changelog_end
2020-01-21 16:11:31 +01:00
Moritz Kiefer
ca3da8ac7c
Use GHC’s syntax for the --package flag (#4136)
* Use GHC’s syntax for the --package flag

The previous syntax was just based on the Read instance of a 3-tuple
which was pretty much unusable. This changes it to GHC’s much nicer
syntax.

I deliberately did not add a changelog entry for this, since this
flag isn’t something that we have documented at all and it is
currently only useful in combination with data-dependencies.

fixes #4126

changelog_begin
changelog_end

* Fix hlint

* get it to compile 😇

* shut up hlint
2020-01-21 13:53:54 +01:00
Moritz Kiefer
dc3953e52f
Remove the key field from pkg.conf files (#4127)
* Remove the key field from pkg.conf files

We never use this and it only a legacy field that is deprecated in
favor of id in GHC.

There is also a minor change in the docs around ExposePackage which
should at most affect error messages.

changelog_begin
changelog_end

* Better error messages
2020-01-21 13:30:38 +01:00
Moritz Kiefer
7525e73134 Bump timeout of packaging tests (#4137)
The packaging tests have grown a fair bit recently and seem to hit
timeouts sometimes. We might want to split it up into multiple tests
suites but for now this should help.

changelog_begin
changelog_end
2020-01-21 11:18:09 +00:00
Moritz Kiefer
7f4061d55c
Remove code for generation of Template and Choice instances (#4131)
The current code has gotten out of sync with the changes to template
desugaring and is therefore simply broken. In addition to that, we
don’t need this once we can use typeclass instances in combination
with data dependencies.

Initially, we just disabled this instead of removing it since we
thought it might still be useful for older packages before typeclasses
are desugared to type synonyms. But we already have one way of
handling those as evidenced in the tests for the DAVL and once we can
call functions from older packages (which works regardless of whether
they have been built before or after the changes to how typeclasses
are desugared), we have another one so I don’t think it makes any
sense to keep this code around.

changelog_begin
changelog_end
2020-01-21 11:57:08 +01:00
associahedron
d9220c6819 damldocs: Refactoring DA.Daml.Doc.Extract (#4112)
* Refactor damldocs

* Refactor damldocs.

changelog_begin
changelog_end

* More refactoring

* Update copyright headers.

* Add export list for Templates

* Add export list to .Util

* added a little ^
2020-01-20 16:17:25 +00:00
Moritz Kiefer
4804fca5d5 Test data-dependencies for more LF version combinations (#4113)
* Test data-dependencies for more LF version combinations

This PR extends the cross-LF version tests to run for all
combinations where depLfVer >= targetLfVer.

changelog_begin
changelog_end

* Fix comments and add TODO
2020-01-20 14:59:43 +00:00
Moritz Kiefer
67f028b0e8
Support cross-SDK data-dependencies against DAVL (#4107)
This PR fixes a minor issue where we were including more references
than we need which causes problems on older SDKs where GHC.Prim is not
a stable module since GHC.Prim cannot be imported (it’s builtin GHC
magic).

More importantly, this PR adds a test for cross-SDK data-dependencies
against the DAVL DAR which is built with SDK 0.13.32 before we started
making all the changes. The test also includes a slightly hacky but
mostly reasonable way of actually using the templates instead of just
the data types from the DAVL DAR which and a scenario to test this.

changelog_begin
changelog_end
2020-01-20 14:54:02 +01:00
associahedron
4a25c8c166
damldocs: Add a --drop-orphan-instances flag (#4100)
* damldocs: Add a --drop-orphan-instances flag

CHANGELOG_BEGIN

- [DAML SDK] Added a ``--drop-orphan-instances`` flag in ``daml damlc
docs``.

CHANGELOG_END

* Update copyright headers

* Document MOVE annotation better and improve orphan instance filter
2020-01-20 10:15:20 +00:00
Moritz Kiefer
9ece831966
Make DAR generation deterministic (#4104)
This fixes the ZIP modification times in all DARs to a specific
value (1980-01-01) whereas they used the current time before. This
both gives us the nice property that not only our DALF builds but also
DAR builds should be deterministic (and there is a test for this). I
have a suspicion that this could help significantly with build times
and avoid rerunning half of the Scala tests on a change to damlc that
should not change the DALFs.

changelog_begin

- [DAML Compiler] The modification times in a DAR are now fixed to a
  given value which makes the output of ``daml build`` deterministic
  in single-threaded mode (which is the default).

changelog_end
2020-01-20 11:00:10 +01:00
Moritz Kiefer
fa8a92f772
Make data-dependencies work with packages produced by damlc (#4099)
This PR fixes a whole bunch of bugs when using data-dependencies on a
package produced by damlc rather than the handcrafted simple-dalf.

The end result is that we are able to build a package with
`--target=1.6` and use it as a data-dependency from a package with
`-target=1.7`. While the test that I’ve added for this is not
cross-SDK it is arguably even trickier since we cannot rely on the
unit id of daml-stdlib changing the version in the unit id.

The changes all fall into one of the following two categories:

- Special handling for daml-prim and daml-stdlib to avoid collisions
  with the one from the current SDK.
- Special treatment of stable packages to avoid generating new code
  for those.
- Remove a couple of filters for daml-prim since we do need to include
  daml-prim from a data-dependency if it is a different version.

This is definitely not perfect and there are a bunch of rather hacky
parts in here but it seems like a good intermediate step (and it has a
test :))

changelog_begin
changelog_end
2020-01-17 20:09:30 +01:00
Moritz Kiefer
f77e326e0b Generate stable DA.Time.Types module as DAML-LF 1.6 (#4095)
This was accidentally set to 1.7 before for no reason. Note that this
simply meant that we did not use the stable module when compiling with
--target=1.6 since we filter out newer stable packages.

Nevertheless, I’ve also added a test that verifies that we do not
accidentally introduce dependencies on packages in newer LF versions.

changelog_begin
changelog_end
2020-01-17 18:05:39 +00:00
associahedron
df2c7c4e34 damldocs: Fix handling of constraint tuples. (#4092)
* Add damldocs golden test for constraint tuples

* Fix constraint check in Extract.hs

changelog_begin
changelog_end

* Document isConstraintType

* Refactor toText away
2020-01-17 14:57:15 +00:00
associahedron
916c70999f Improve docs around the new Template, Choice, TemplateKey constraints. (#4069)
* Try to improve the docs on DA.Internal.Template.Functions a little.

* More docs.

changelog_begin

- [DAML Standard Library] The ``Template``, ``Choice``, and
``TemplateKey`` typeclasses have been split up into many small typeclasses
to improve forward compatibility of DAML models. ``Template``,
``Choice`` and ``TemplateKey`` constraints can still be used as before.

changelog_end

* Example typo
2020-01-17 11:47:35 +00:00
Moritz Kiefer
74d12ce39a Bump ghcide to include bugfix (#4074)
* Bump ghcide to include bugfix

This includes a fix for a bug in completions which we introduced in
the latest ghcide bump which in turn broke the DAML IDE completely.

changelog_begin

- [DAML Studio] Fix a bug in completions that caused DAML Studio to
stop responding after the first completion was requested.

changelog_end

* Use ghcide from master branch and simplify test
2020-01-16 18:38:58 +00:00
Robin Krom
0a26591849
upgrading to newest nodejs_rules (#4057)
* upgrading to newest nodejs_rules

CHANGELOG_BEGIN
CHANGELOG_END

* addressing andreas comments
2020-01-16 15:55:32 +01:00
associahedron
5d3040835a LF conversion of templates under new rules (WIP). (#4030)
* Patterns and test for new desugaring

* working on new template conversion

* Update ghc-lib

changelog_begin
changelog_end

* shut up hlint

* Update desugar stdlib

* update test

* remove unuseful templatebinds

* Add implicit qualified GHC.Types import

* Add missing primitives

* Remove chaff

* update comments

* Remove patterns that dont seem useful anymore

* Capture key data in template binds

* Dont make TypeRep/ToAny/FromAny classes conditional

* Remove some unnecessary TODOs

* Generate the template definition

* Remove new template desugaring test

* Fix jq query

* Rename makeDesugarDFunProjection to useSingleMethodDict

* Let TTypeRep and TAny be TUnit in primitives.

* Fix damlc visual wrt the new desugaring

* Fix visualization tests in shake test suite

* Fix damldocs

* Drop envTemplateKeyData

* Use the new ghc-lib release

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-15 18:03:15 +01:00
Moritz Kiefer
8cf4e9a9ef Allow invoking generate-src on the main dalf of a dar (#4051)
* Allow invoking generate-src on the main dalf of a dar

Given that daml build outputs a .dar file this is much more convenient
for testing against actual build outputs of damlc rather than
handcrafted .dalf files.

The behavior matches the one of `damlc inspect` in that it detects
whether it works on a .dar or a .dalf based on the file ending.

changelog_begin
changelog_end

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

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-01-15 11:02:35 +00:00
Moritz Kiefer
b5508cdc5b Disable generation of Template instances (#4043)
The generation of Template instances will break horribly with
https://github.com/digital-asset/daml/pull/4030 and we don’t actually
want to use this anymore since we want to reuse old class
instances. There are some cases where we might still need or want this
in the future (see the inline comment), so for now, the code for this is still left intact and
only disabled.

changelog_begin
changelog_end
2020-01-14 17:27:42 +00:00
Moritz Kiefer
f308c433e8
Simplify building the GHC AST for data dependencies (#4042)
This PR adds a bunch of top-level helpers that take care of building
up the GHC AST.

I’ve also briefly played around with not using the GHC AST at all but
that doesn’t seem to really help simplify things so for now, I think
this is the better approach

changelog_begin
changelog_end
2020-01-14 15:50:12 +01:00
Moritz Kiefer
136c2147c0 Remove version suffix from stable packages in daml-stdlib (#4037)
Given that these packages should be stable it makes no sense to
include the version in them.

changelog_begin
changelog_end
2020-01-14 12:08:51 +00:00
nickchapman-da
d8a0ddfcb8
fix bug in freeVars code (#4027)
* fix bug spotted while passing

CHANGELOG_BEGIN
CHANGELOG_END

* testcase for bug

* hlint

* remove unnecessary params to placate hlint
2020-01-14 11:52:58 +00:00
Moritz Kiefer
2d0d79e889 Don’t expose primitive and magic (#4035)
Previously, we exposed those functions from Prelude which really
doesn’t make any sense given that they are intended for the internal
implementation of daml-prim and daml-stdlib.

changelog_begin
changelog_end
2020-01-14 09:42:31 +00:00
nickchapman-da
73978cd212
check for and reject cyclic type synonym definitions (#4026)
* CHANGELOG_BEGIN
check for and reject cyclic type synonym definitions
CHANGELOG_END

* mark 2x comments as TODO
2020-01-13 17:32:55 +00:00
Moritz Kiefer
dacf7203f0 Respect build-options if project-root is used (#4025)
* Respect build-options if project-root is used

changelog_begin

- [DAML Compiler] The ``build-options`` field from ``daml.yaml`` is
now also respected if ``--project-root`` is used.

changelog_end

* address review comments
2020-01-13 15:18:40 +00:00
Moritz Kiefer
b42216a2fa Bump ghcide (#4013)
* Bump ghcide

changelog_begin
changelog_end

* Fix ghcide target

* fix the fix
2020-01-10 19:06:42 +00:00
nickchapman-da
006aa9b608
Type checking DAML-LF type synonyms (#3959)
* CHANGELOG_BEGIN
Type-check type synonyms.
CHANGELOG_END

* placate HLint

* comments

* Add an example that requires the check in kindOf

* check types containing syn-apps are well formed even when there is no expression of that type

* show type mismatch error after synonyms are expanded

* typeOf calls expandTypeSynonyms; track vars bound by TForall during expansion

* test interaction of syn-expansion and free-vars; add one bigger testcase

* extend bigger example with pointed typeclass, having functor as a super class

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-01-10 17:51:51 +00:00
Remy
c0f387ff25 Engine: Small refactoring of partial transactions (#3951)
* small refactoring of partial transaction

CHANGELOG_BEGIN
CHANGELOG_END

* cosmetic changes
2020-01-09 19:01:44 +00:00
Moritz Kiefer
53f25599d0 Send session ping telemetry messages (#3997)
* Send session ping telemetry messages

This PR adds telemetry information that is sent regularly (every 5
minutes) while users are active (they’ve opened, closed or changed a
file). This allows us to track how long user sessions are.

This PR does not include any additional information in the session
ping but we plan to add more in the future.

The ping messages can be found in big query by filtering for
`jsonPayload.type = "session_ping"`.

CHANGELOG_BEGIN
CHANGELOG_END

* add copyright header
2020-01-09 14:34:23 +00:00
Moritz Kiefer
ad5e05c2ce Remove Optional from internalTypes (#3981)
That list only contains types in DA.Internal.LF whereas Optional is in
DA.Internal.Prelude.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-08 14:05:58 +00:00
Moritz Kiefer
7bce23525f
Verify expected hashes of stable LF packages (#3978)
As mentioned in the comment, it doesn’t really make sense to include
the SDK version in the DALF names but I’ll address this in a separate
PR.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-08 14:34:44 +01:00
Moritz Kiefer
0ec595b680
Add regression test for unstable serializable types (#3976)
* Add regression test for unstable serializable types

This test verifies that we only have the serializable types in
daml-prim and daml-stdlib that we expect and don’t introduce new ones
by accident.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix windows

* Ignore whitespace because windows

* optional is dead
2020-01-08 12:06:07 +01:00
Moritz Kiefer
86951ea106
Remove Optional definition in LF conversion (#3973)
All references to Optional are already mapped to the builtin Optional
type in LF but we forgot to filter out the type definition.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-08 11:32:41 +01:00
Moritz Kiefer
a8b4a84b08
Move most of the remaining serializable types to stable LF packages (#3964)
* Move most of the remaining serializable types to stable LF packages

The only serializable types left in DAML stdlib after this PR are the
following:

- DA.Upgrade:MetaEquiv
- DA.Random:Minstd
- DA.Next.Set:Set
- DA.Next.Map:Map
- DA.Generics:MetaSel0
- DA.Generics:MetaData0
- DA.Generics:DecidedStrictness
- DA.Generics:SourceStrictness
- DA.Generics:SourceUnpackedness
- DA.Generics:Associativity
- DA.Generics:Infix0
- DA.Generics:Fixity
- DA.Generics:K1
- DA.Generics:Par1
- DA.Generics:U1
- DA.Internal.Prelude:Optional

Ignoring the Generics stuff which isn’t very urgent imho and the
Upgrade stuff which is probably going to change significantly anyway,
this leaves us with the weird Random module, the wrappers around
TextMap which will go away anyway and DA.Internal.Prelude:Optional
which shouldn’t exist in the first place (I’ll address that in a
separate PR).

CHANGELOG_BEGIN

- [DAML Compiler] Move more types from daml-stdlib to standalone LF
packages. The module names for the types have also changed
slightly. This only matters over the Ledger API when you specify the
module name explicitly. In DAML you should continue to use the
existing module names.

  - The types from ``DA.Semigroup` are now in a separate package under
  ``DA.Semigroup.Types``
  - The types from ``DA.Monoid` are now in a separate package under
  ``DA.Monoid.Types``
  - The types from ``DA.Time` are now in a separate package under
  ``DA.Time.Types``
  - The types from ``DA.Validation` are now in a separate package
  under ``DA.Validation.Types``
  - The types from ``DA.Logic` are now in a separate package under
  ``DA.Logic.Types``
  - The types from `DA.Date` are now in a separate package under
  `DA.Date.Types`.
  - The `Down` type from `DA.Internal.Prelude` is now in a separate
  package under `DA.Internal.Down`.

CHANGELOG_end

* Fix serializability of RelTime

* fix daml-docs

* Fix tests
2020-01-07 18:25:23 +01:00
associahedron
ec769ede31
damldocs: Add --exclude-instances option and exclude HasField instance docs from stdlib. (#3962)
* Refactor transform options

* Finish refactoring and implement --exclude-interface

* Exclude HasField instances from stdlib docs.

CHANGELOG_BEGIN

- [DAML SDK] ``daml damlc docs`` now accepts a ``--exclude-instances``
option to exclude unwanted instance docs by class name.

CHANGELOG_END

* s/excludeInstances/excludeInterfaces/g

* Review comments
2020-01-07 15:32:46 +00:00
Gary Verhaegen
386250102b
remove MissingH (#3948)
I noticed all uses of this library had been removed by #3943, but the
library itself wasn't.
2020-01-06 14:36:14 +01:00
Andreas Herrmann
43bbfeaee6
Remove unused dependencies to da_scala_binary (#3937)
* Inline all scala_binary dependencies

* Run //:buildifier-fix

* da_scala_binary: Enable unused dependency checker

* //compiler/scenario-service/server:scenario-service-raw

* //language-support/scala/codegen:codegen-main

* //daml-lf/encoder:encoder_binary

* //daml-lf/repl:repl

* //language-support/codegen-main:codegen-main

* //language-support/scala/examples:quickstart-scala-bin

* //ledger-api/rs-grpc-akka:rs-grpc-akka-perf

* //ledger-service/jwt:jwt-bin

* //ledger/api-server-damlonx/reference-v2:reference-v2

* //ledger/api-server-damlonx/reference-v2:ephemeral-postgres-reference-server

* //ledger/ledger-api-auth:ledger-api-auth-bin

* //ledger/ledger-api-test-tool:ledger-api-test-tool

* //ledger/participant-state/kvutils/tools:integrity-check

* //navigator/integration-test:navigatortest-jar

* Run //:buildifier-fix

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2020-01-06 13:58:56 +01:00
Moritz Kiefer
42c586f8d4
Bump ghcide (#3943)
* Bump ghcide

* Fix ghcide build

* Include bugfix for Windows
2020-01-04 07:51:51 +01:00
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01:00
Andreas Herrmann
9fbb787062 Remove unused dependencies to da_scala_test(_suite) (#3925)
* Remove unused scala.bzl imports

* override_targets org.scalatest.scalatest_2.12

Otherwise, rules_scala implicitly adds a different version to scala_test
than other packages transitively depending on scalatest. This causes
unused dependency checker to raise an error.

* Handle rules_scala scalatest in pom_file.bzl

* Inline all scala_test dependencies

So that `unused_dependency_checker = "error"` can be applied to them.

* Run //:buildifier-fix

* TMP scala_test_suite --> scala_test

* da_scala_test: Enable unused dependency checker

* //navigator/backend:navigator-scala-tests

* //ledger/sandbox:sandbox-scala-tests

* //ledger/participant-state/kvutils:kvutils-tests

* //ledger/participant-state:participant-state-tests

* //ledger/ledger-api-scala-logging:ledger-api-scala-logging-test

* //ledger/ledger-api-common:ledger-api-common-scala-tests

* //ledger/ledger-api-client:ledger-api-client-tests

* //ledger/ledger-api-auth:ledger-api-auth-scala-tests

* //ledger-service/lf-value-json:tests

* //ledger-service/jwt:tests

* //ledger-service/http-json:tests

* //ledger-api/rs-grpc-akka:rs-grpc-akka-tests

* //language-support/scala/codegen-sample-app:tests

* //language-support/scala/codegen-sample-app:ScalaCodeGenIT

* //language-support/scala/codegen:tests

* //language-support/scala/bindings-akka:tests

* //language-support/java/codegen:test

* //language-support/java/codegen:ledger-tests

* //language-support/java/bindings-rxjava:bindings-java-tests

* //language-support/codegen-common:test

* //extractor:extractor-scala-tests

* //daml-lf/scenario-interpreter:scenario-interpreter_tests

* //daml-lf/language:language-test

* //daml-lf/interface:tests

* //daml-lf/engine:tests

* //daml-lf/encoder:tests

* //daml-lf/archive:daml_lf_archive_reader_tests

* //daml-assistant/scala-daml-project-config:scala-daml-project-config-tests

* UNDO scala_test_suite --> scala_test

This reverts commit 13ed47ba725e944533ca1157a070cb8dc30569ac.

Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
2019-12-30 13:49:59 +00:00
Rohan Jacob-Rao
f04ce1a3c8
Fix typo in hlint rule (#3926) 2019-12-26 16:23:04 -05:00
Martin Huschenbett
b72dbb90f2 Remove some dlint rules which don't apply to DAML (#3920)
Also fix some rules to use `mapA` and friends instead of `mapM` and friends.
2019-12-22 07:56:18 -05:00
Martin Huschenbett
be8c55e666
Remove dlint hint notes mentioning NaN (#3916)
There's no NaN in DAML, hence the note that a refactoring suggested by dlint
is wrong for NaN is useless.
2019-12-20 13:15:15 +01:00
Moritz Kiefer
10a7715d2b Avoid globbing for stable packages (#3905)
I managed to break our Windows CI twice already due to this so while
it makes me sad, I think hardcoding those files is the more sensible
option for now.
2019-12-19 10:29:10 +00:00
Moritz Kiefer
c48b0ee289 Move Any wrappers and Archive to stable packages (#3890)
* Move Any wrappers and Archive to stable packages

There are no actual API or functionality changes in this PR but the
logic for locating the stable packages has slightly changed since the
Any wrappers package only makes sense for LF 1.7. To address this, we
simply filter out stable packages for newer LF versions since it
doesn’t make sense to depend on those anyway.

CHANGELOG_BEGIN

- [DAML Compiler] Move ``Archive`` type to a separate DALF.

CHANGELOG_END

* More comments

* Fix java codegen tests

* fix more tests

* Force cache reset on Windows

* Revert "Force cache reset on Windows"

This reverts commit 9f2b7d70b2.
2019-12-19 01:26:38 +00:00
Martin Huschenbett
8c53ffcba0 Clean up the CPP around roundCommercial (#3889) 2019-12-18 13:39:25 +00:00
Moritz Kiefer
7080fd7961 Fix roundCommercial (#3886)
* Fix roundCommercial

fixes #3884

Previously, we relieid on being able to convert to an Int, which
doesn’t work since there are Numeric values that cannot be represented
as an Int. Now, we avoid any conversions to Int which fixes this
issue.

We probably just want to have a primitive for this at some point but
given that this will only be available in newer LF versions, I think
it’s worth working around this for now.

* Move tests to a separate file to exclude LF 1.6

* Update compiler/damlc/daml-stdlib-src/DA/Internal/Prelude.daml

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Apply suggestions from code review

Co-Authored-By: Remy <remy.haemmerle@daml.com>

* Update comments

* Update compiler/damlc/daml-stdlib-src/DA/Internal/Prelude.daml

Co-Authored-By: Remy <remy.haemmerle@daml.com>
2019-12-18 12:16:04 +00:00
Moritz Kiefer
2059c4d146
Move stable types from DA.Internal.Template to a separate module (#3876)
* Move stable types from DA.Internal.Template to a separate module

This is in preparation for splitting them into a separate LF package
with a stable package id.

* Fix visualization

* Fix data dependencies
2019-12-17 21:23:04 +01:00
Moritz Kiefer
52e594a2e9
Move optWriteIface to compile-specific options (#3861)
Originally, this made sense as a flag in Options since we read it
during typechecking to write out interfaces on the fly. But now, we
write this is only used in execCompile so having this be a global
option that is ignored anywhere but in `compile` is rather confusing.
2019-12-17 11:05:28 +01:00
Moritz Kiefer
c65f918145
Bump ghcide (#3865)
* Bump ghcide

* Fix goto definition tests

* Fix hie-bios config

* Try to fix windows
2019-12-17 10:21:52 +01:00
Moritz Kiefer
ddef6c7bce Document packaging code (#3860)
This documents some of the edge cases in the packaging code that I’ve
had trouble understanding so that the next person hopefully has an
easier time with this.

There is also some minor cleanup in this PR.
2019-12-16 13:44:19 +00:00
nickchapman-da
1369351f70
separate type-synonyms from type-constructors (#3829)
* separate type-synonyms from type-constructors in DAML-LF .proto and Haskell AST

* comments
2019-12-16 11:52:28 +00:00
Moritz Kiefer
54f0fa0f50 Improve documentation on precision and scale of Numeric (#3846)
* Improve documentation on precision and scale of Numeric

fixes #3778

* s/precision/scale/
2019-12-16 10:06:47 +00:00
Moritz Kiefer
d675156e2c
Bump ghcide to fix flakiness in LSP tests (#3813)
fixes #3821

see https://github.com/digital-asset/ghcide/pull/235 for the actual
fix, I’ll change the commit before merging.
2019-12-12 17:11:35 +01:00
associahedron
4fe8cbff6e Run a package-wide name collision check when building a DAR. (#3827)
* Perform full package name collision check

* Comment on the ascendants thing

* Fix comment
2019-12-12 13:27:22 +00:00
Moritz Kiefer
1767b2e6bf
Remove mysterious hFlush stdout (#3825)
This has been there since before we open sourced DAML and afaict if it
has ever served any purpose, that purpose is long gone.
2019-12-12 09:36:47 +01:00
Moritz Kiefer
013d668159 Add Eq instances for AnyTemplate, AnyChoice and AnyContractKey (#3816)
* Add Eq instances for AnyTemplate, AnyChoice and AnyContractKey

CHANGELOG_BEGIN

- [DAML Standard Library] Add ``Eq`` instances for ``AnyTemplate``, ``AnyChoice`` and ``AnyContractKey``.

CHANGELOG_END

* Add DAML_ANY_TYPE to the CPP guard
2019-12-11 14:59:50 +00:00
Moritz Kiefer
d6bf6f6c04 Mark lsp tests flaky (#3818) 2019-12-11 14:10:48 +00:00
associahedron
76531c93bf Expose generic equality in compiler (#3815) 2019-12-11 12:15:52 +00:00