Commit Graph

937 Commits

Author SHA1 Message Date
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
associahedron
08ee42fb30 Implement missing genmap fns (#3807) 2019-12-11 11:16:25 +00:00
Moritz Kiefer
e3830106ad
Fix package names in depends field in pkg configs (#3810)
* Fix package names in depends field in pkg configs

Previously, we derived this based on the DAR name which breaks if you
use -o with rather confusing error messages. Now, we read it from the
`Name` field in the manifest that we added in
https://github.com/digital-asset/daml/pull/3805.

CHANGELOG_BEGIN

- [DAML Compiler] Fix an issue where transitive package dependencies
  resulted in packages not being found, if the DAR name was changed with
  `-o`.

CHANGELOG_END

* Fix package dependencies
2019-12-11 11:49:50 +01:00
Moritz Kiefer
4413ecc118
Include package name in manifest file (#3805)
Currently, we generate the `depends` field in the ghc-pkg config file
based on the file name of the DARs in the `dependencies` field in
`daml.yaml`. This falls apart when you use the -o option to `daml
build` since `ghc-pkg` will complain about missing packages.

This PR adds the name to the manifest so that we can generate the
`depends` field based on that but I’ll leave that change for a
separate PR.
2019-12-10 17:12:19 +01:00
Shayne Fletcher
ab7c5791b7
Convert match (#3795)
* Update hlint

* Redefine base package to make more sense for daml

Also, elminate lens and attoparsesec packages and groups.

* Don't change the test; ignore the new lints

* More conversion haskell rules to daml
2019-12-10 08:24:26 -05:00
Moritz Kiefer
6716947931 Bump ghcide (#3800) 2019-12-10 13:05:20 +00:00
Remy
5f0976343c
DAML-LF: fix subsitution bug (#3798)
* damlc lf typechecker: expose subtitution bug

* Fix substitution bug

* Rename variables

* fix subsitution bug in scala side

* reactive some test

* Update daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/TypeSubst.scala

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

* Update daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/TypeSubst.scala

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-12-10 13:36:55 +01:00
Moritz Kiefer
e769264ddf Move all datatypes out of daml-prim (#3791)
* Move all datatypes out of daml-prim

This moves the remaining two modules DA.Types and GHC.Tuple to
separate LF packages with stable identifiers.

The only data types remaining are the ones for typeclasses which will
disappear once we move this to type synonyms.

CHANGELOG_BEGIN

- [DAML Compiler] The modules DA.Types and GHC.Tuple from daml-prim
have been moved to separate packages.

CHANGELOG_END

* Fix codegen tests

* Fix DarReader test

* Fix kvutils tests

* Fix jdbcdao tests

* Fix hs ledger bindings tests
2019-12-10 09:19:16 +01:00
Rohan Jacob-Rao
37fa12c943
Remove blog post notifications (#3794)
* Disable IDE notifications about new blog posts

* Remove notification setting
2019-12-09 15:41:56 -05:00
associahedron
c97a5e7aaf Workaround and test for #3777 (#3790) 2019-12-09 16:50:54 +00:00
associahedron
398a1237ca Perform name collision check against other names in package. (#3770)
* Full package name collision check

* Handle type synonyms appropriately

* Better comment

* Make isAscendant case-insensitive

* Document isAscendant and explain case-insensitivity

* Add a package-wide name collision test.
2019-12-09 16:36:55 +00:00
Martin Huschenbett
0211e1337d Move the bazel aliases for yarn and java to the root BUILD file (#3786)
Replicating the yarn alias in multiple places doesn't make sense.
2019-12-09 13:22:21 +00:00
Remy
e055b2bd9b DAML LF: expose generic equality in LF (#3752)
* daml-lf: expose generic equality

* drop unnecessary parentheses

* fix issue number

* address Fran's comments
2019-12-06 14:12:48 +00:00
Moritz Kiefer
321032a0f2 Create a new type for package imports (#3765)
My brain can’t handle 3-tuples with strings and booleans, so this PR
introduces a new record type to make those fields clearer.
2019-12-06 14:02:59 +00:00
Moritz Kiefer
3f12e60b12 Refactor packaging logic (#3749)
* Refactor packaging logic

This is a first step towards cleaning up the packaging logic and
adding some comments to make it clearer what is going on. There are no
functional changes in this PR.

There is more stuff here that we can and should cleanup but I will
leave that for separate PRs.

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

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

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

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

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

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

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

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

* Document topological sorting

* Undo requiredE change
2019-12-06 09:55:27 +00:00
Moritz Kiefer
e9d7e783f2
Fix incremental builds (#3751)
Sadly, I haven’t managed to come up with an isolated test case for
this but I’ve tested this on a large internal codebase and it fixes an
issue with damlc build --incremental=yes.
2019-12-05 17:07:20 +01:00
associahedron
8127a415d9
Add unstable experimental text primitives in DA.Text and LF 1.dev (#3734)
* Add experimental text primitives

* Implement SBTextSlice

* Implemented SBTextSliceIndex

* Implement toUpper / toLower

* Implement SBTextContainsOnly

* Implement SBTextReplicate

* Implement SBTextReplicate

* Implement SBTextSplitOn

* Implement SBTextIntercalate

* Add unstable primitives in LFConversion

* Add unstable text primitives in DA.Text

* Remove all the ASCII infixes

* Fix typing mishap

* Change numbering for unstable primitives

* Deal with UTF8

* More careful slice

* Fix typo

* Missing decoder
2019-12-05 14:35:50 +00:00
Robin Krom
3f666792b1 language: suffix all dalfs dependencies in a dar with the pkgid. (#3668)
* language: suffix all dalfs dependencies in a dar with the pkgid.

This makes sure that dalf dependencies are not accidentally overwritten
when two packages with equally named dalfs are imported.

* factor out parseUnitId
2019-12-05 11:47:45 +00:00
Rohan Jacob-Rao
77c3819ea6 Fix logic for blog notifications (stop treating arrays as strings) (#3738) 2019-12-04 21:12:21 +00:00
Moritz Kiefer
ba30e86911
Split wired-in modules into separate LF packages (#3696)
This is a first step towards making sure that the package ids for
types defined in daml-prim and daml-stdlib don’t change. This PR
mostly adds all the necessary infrastructure for that and moves
GHC.Types and GHC.Prim to make sure it works.

Until data-dependencies are really solid and we have verified that we
no longer have performance issues with an increasing number of Haskell
packages, we still include the source files in daml-prim and then just
rewrite the references.

We will also need to add tests that these packages really have stable
ids but I’ll leave that for separate PRs since this doesn’t make that
much sense anyway until all of the types have moved to stable
packages.

CHANGELOG_BEGIN

- [DAML Compiler] The modules GHC.Prim and GHC.Types from daml-prim
have been moved to separate packages.

CHANGELOG_END
2019-12-04 16:42:48 +01:00
Jussi Mäki
95ddb65483
DAML Engine: accurate package dependency annotations (#3726)
* Track used packages during whole of engine submit

- Introduce MutableCompiledPackages interface
- Add TrackingCompiledPackages that tracks fetched packages
- Make used packages in transaction optional to distinguish between
  missing dependencies and empty set of dependencies.

* Reimplement package dependency tracking

- Compute direct dependencies of a package during decoding
- Compute transitive dependencies of a package when adding a package
  to engine.
- Annotate the resulting transaction with package dependencies
  in Engine.submit.

* Create Ast.Package with proper direct deps in scenario service

While we don't have use for direct dependencies of a package in
scenario service (only Engine.submit needs it), it's better to be
accurate.

This of course overapproximates the direct dependencies.

* Compile a each new package once in ConcurrentCompiledPackages
2019-12-04 15:01:21 +01:00
nickchapman-da
d15b0c7538
Add support for type-synonyms in DAML-LF .proto and Haskell AST (#3703)
* Add support for type-synonyms in DAML-LF .proto and Haskell AST

* address review comments
2019-12-03 14:51:02 +00:00
Martin Huschenbett
054fcd22f2 Remove component version from damlc output (#3709)
The component version is a relic from before we went to a mono repo.
It's completely useless now.
2019-12-03 14:06:49 +00:00
associahedron
b275a5f40a Use surface names for type variables, instead of uniques. (#3702)
* Use surface names instead of unique names

* Reviewer comments
2019-12-03 09:40:04 +00:00
Moritz Kiefer
5a3b5f498a Fix SDK versions in trigger and daml-script dars (#3706)
* Fix SDK versions in trigger and daml-script dars

* Fix SDK versions in tests
2019-12-03 07:28:49 +00:00
associahedron
608a820c26
Remove generic template support from damldocs (#3693) 2019-12-02 15:08:06 +00:00
associahedron
e696c34fc0
Let damlc docs see build-options. (#3695)
CHANGELOG_BEGIN

- [DAML SDK] ``damlc docs`` now takes into account the project's ``build-options`` from ``daml.yaml``.

CHANGELOG_END
2019-12-02 15:07:15 +00:00
Martin Huschenbett
6e6614ae56 daml2ts: Use monoTraverse to collect modules refs in types (#3690)
This was suggested by @corcreature on a previous PR.
2019-12-02 14:56:22 +00:00
Moritz Kiefer
4a5d07fccb Expose keys and values function from DA.Map (#3684)
fixes #2759
2019-12-01 11:49:23 +01:00
Moritz Kiefer
de28191e54 Remove unused fields from LF conversion env (#3683)
These fields were used for generic templates so they are no longer
needed.
2019-12-01 11:34:01 +01:00
Moritz Kiefer
3205e05d42 Update docs for coerceContractId (#3686)
I’ve gone through references to generic templates in our codebase to
see what else we can drop. In this case, we are still using
coerceContractId so I’ve updated the comment to explain the current
usecase.
2019-12-01 09:19:45 +01:00
Moritz Kiefer
4eceda8364 Remove special treatment of generic template type synonyms (#3681) 2019-11-29 16:09:23 +00:00
Moritz Kiefer
e4c61ae8b9 Remove check for generic templates (#3680)
We now reject these in the parser so there is no point in keeping this
in the preprocessor.
2019-11-29 15:58:27 +00:00
Martin Huschenbett
ea89dbb122 Don't make UndecidableSuperClasses a default extension for DAML (#3673)
We needed this for our generic template hacks. Since they are gone now,
I'm very much in favour of removing this extension since "undecidable"
always sounds a bit scary, even if it is only at compile time.

CHANGELOG_BEGIN

- [DAML Compiler] Don't make `UndecidableSuperClasses` a default language
  extension for DAML anymore. If you really need this feature for a module,
  you can reenable it using a `LANGUAGE` pragma at the top.

CHANGELOG_END
2019-11-29 15:51:40 +00:00
Moritz Kiefer
75c9b1bf91
Simplify template desugaring (#3670)
* Introduce a simpler template desugaring without support for generic templates

This adapts the LF conversion to the new template desugaring
introduced in our GHC fork. The guiding principle is that we use the
typeclasses directly to avoid generating, typechecking and converting
redundant code caused by indirections. I updated the template
desugaring documentation so that is probably a good starting point for
reviewing this.

* Address review comments

* Fix daml doc tests

* Fix data dependency tests

* Switch to new ghc-lib release
2019-11-29 16:13:15 +01:00
Martin Huschenbett
0e8c2bbc6f Improve the error message for polymorphic numeric literals (#3672)
Display the actual number the user tried to use instead of 1.2345.

The logic to display the number is not perfect but definitely better than
we have now. If somebody knows a _simple_ way to do this better, please
tell me about it.
2019-11-29 08:51:32 +00:00
associahedron
aafa107a80
Update DataDependencies.hs for GenMap (#3671) 2019-11-29 08:29:48 +00:00
Martin Huschenbett
bf5310060c Don't break long party names in scenario view weirdly (#3669)
Until now, we broke long party names in the table view in the scenario at
spaces. This looked quite ugly.

Now, we don't break them at spaces. At the same time we also moved the CSS
into a file rather than having it in the code to make changes like this one
easier in the future.

This fixes #3642.
2019-11-29 08:10:44 +00:00
associahedron
405ae5a8d8 Implement DAML constraint tuples as LF structs. (#3667)
* Constraint tuples

* LF Tuples -> Structs

* A couple that got away

* Dead code elim

* Better documentation for constraint tuple projection functions

* strict -> struct

* readability on constraint tuple projection conversion

* Add mkIndexedField
2019-11-28 17:18:55 +00:00
nickchapman-da
885bbefdf3 rename structural records: tuple -> struct (#3660)
* rename structural records: tuple -> struct

* add missing renames (tuple -> struct) in comments, var-names and error messages

* exposition: structural vs nominal; change history note

* remove accidentilly checked-in file
2019-11-28 10:00:24 +00:00
Martin Huschenbett
fbac97bda7 Remove the FooInstance rewriting hack used for generic templates (#3659)
This hack is not necessary anymore. A future addition of generic templates
must be significantly less hacky than this.
2019-11-28 08:50:40 +00:00
nickchapman-da
d3d6891021
Rename daml lf tuples (#3658)
* Rename DAML-LF tuples as structs (structural records)
2019-11-28 07:58:30 +00:00
Robin Krom
faa150b310
language: reenable migration checks (#3650)
This reenables the migration checks. The migration command now only
generates stumbs for conversions instead of using the formerly (generic)
upgrade template.
2019-11-27 17:10:54 +01:00
associahedron
aebf7452f6
Add generic maps to stdlib in DA.Map (#3651)
* Add generic maps to stdlib in DA.Map

* Update copyright headers

* Add doctests and fix memory tests
2019-11-27 14:29:06 +00:00
Rohan Jacob-Rao
094214aa55 Notify IDE users about new daml-driven blog posts (#3623)
* Successfully parse rss xml and find latest blog post object

* Show notification with link to blog (on every ide startup...)

* Only show blog post if not seen before

* Formatting

CHANGELOG_BEGIN

- [SDK] Notify IDE users about new daml-driven blog posts

CHANGELOG_END

* Add setting for user to opt out of notifications

* Use await rather than then

* Catch and swallow exceptions

* Another await and minor cleanup
2019-11-26 19:34:56 +00:00
Robin Krom
d90eb357ad
language: upgrades: prefix stdlib imports everywhere. (#3633) 2019-11-26 19:28:11 +01:00
Martin Huschenbett
167232bd81
Ban usage of generic templates (#3631)
We don't drop full support from the compiler yet but rather ban their use by
adding a check to the preprocessor. We'll remove the actual support as we go
along with fixing the upgrading story.

CHANGELOG_BEGIN

- [DAML Compiler] Make the experimental feature "generic templates"
  unavailable. The current implementation is at odds with other, more important
  language features still under development.

CHANGELOG_END
2019-11-26 17:15:17 +01:00
Andreas Herrmann
15f12eea6a Remove Bazel override (#3603)
* Remove Bazel override

The extended default shell env is no longer required. See
https://github.com/digital-asset/daml/pull/3597#pullrequestreview-322096242

* Import diff from rules_sh posix toolchain
2019-11-26 09:06:44 +00:00
Moritz Kiefer
770a9ae5e4 Support empty packages in daml build (#3624)
We still error out if the directory in `src` doesn’t exist to catch
typos.
2019-11-25 20:44:34 +00:00
Remy
d152c7cbfd daml-lf: rename Map to TextMap in archive proto (#3589)
* daml-lf: rename Map to TextMap in archive proto
+ in Scala/haskell AST

* a bit more renamming

* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/Serializability.hs

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

* fix test

* Apply suggestions from code review

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

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

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-11-25 12:14:57 +00:00
associahedron
367a1d8ceb Set Sdk-Version in DAR Manifest to compiler SDK version. (#3587)
* Set Sdk-Version in DAR Manifest to compiler SDK version.

CHANGELOG_BEGIN

- [DAML Compiler] Bugfix: The Sdk-Version field in a DAR manifest file
now matches the SDK version of the compiler, not the sdk-version field
from daml.yaml. These are usually the same, but they could be different
if you set the DAML_SDK_VERSION environment variable before running
``daml init`` or ``daml build``.

CHANGELOG_END

* Fallback to daml.yaml if env var not set

* add yaml dependency

* Always require sdk-version, and emit warning on mismatch with env var

* More explicit about where override comes from

* Add packaging regression test
2019-11-22 16:25:58 +00:00
Andreas Herrmann
f4d0eb636e Replace Hazel by stack_snapshot (#2743)
* Unmangled libz.so and libbz2.so

* Use stack_snapshot instead of Hazel

* Remove Hazel

* Define stack_snapshot

* Update rules_haskell

* Document stack_snapshot

* Clean stack's lock file from aborted builds
2019-11-22 14:24:08 +00:00
Remy
3f8bd0da5e DAML-LF: rename ValueMap to ValueTextMap. (#3584) 2019-11-22 11:35:32 +00:00
Ben Price
96c15a7f42 add kleisli composition operators (#3563) 2019-11-21 13:00:11 +01:00
Moritz Kiefer
61739bc49e Move non-upgrading code to a separate DataDependencies module (#3552) 2019-11-20 16:43:10 +00:00
Moritz Kiefer
c501866608 Trim exports from Upgrade module (#3551)
None of those functions are actually used outside the module and I
prefer seeing the actual external API.
2019-11-20 14:54:27 +00:00
Moritz Kiefer
1bc4bb76a4 Make AnyChoice and AnyContractKey take template type into account (#3541)
* Make AnyChoice and AnyContractKey take template type into account

fixes #3540

* Update template desugaring

* Switch to proper ghc-lib release
2019-11-20 10:40:14 +00:00
nickchapman-da
e2a8cc29e5
Choice instances for cross sdk (#3477)
* generate choice instances for cross sdk dependencies

* add line to test cross-sdk exercise of choice

* revert to naming choice in GenerateSimpleDalf as "NotChoice"

* remove filter/special-handlimg for "Archive" choice

* dont assume a tycon with the same name as a choice; instead use type from chcArgBinder

* error if cant find the template datatype def

* naming

* avoid intercalate followed by re-split on "." in module name

* GenerateSimpleDalf: have two choices: one of record type, one of variant type

* Update Upgrade.hs

* added some linebreaks, spaces for readability

* address cosmetic comments

* use Sdk. prefix as necessary so tests work

* mollify hlint

* fix: daml-assistant/integration-tests
2019-11-20 07:29:56 +00:00
Rohan Jacob-Rao
fa8be840a8 Change title of release notes tab (#3535)
* Change title of release notes tab

This suggests that a new release is available, but not necessarily
installed. We do this for the case that the extension is updated
(which triggers the tab to open) but the actual SDK is not.

* Keep 'New'

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-11-19 22:00:53 +00:00
Moritz Kiefer
8615266230 Switch the default DAML-LF version to 1.7 (#3530) 2019-11-19 19:18:07 +00:00
Martin Huschenbett
c33517cf9f MVP for a daml2ts codegen (#3441)
* MVP for a daml2ts codegen

This PR adds an MVP for a codegen for TypeScript.

Given a DAR, daml2ts replicates the structure of the serializable type
definitions in it as TypeScript type definitions following our JSON
representation of DAML-LF types. It also adds decoders for all these types,
which can be used to check where an arbitray JSON value has the given type.
Finally, daml2ts also produces one JavaScript object for each template, which
reflects the type information of that template.

All produces objects implement some interfaces defined in a TypeScript
library currently called `@digitalasset/daml-json-types`. This libary is not
yet uploaded to NPM but rather included in the `tests/ts/daml-json-types`
directory. This libary also contains the JSON decoders for all of DAML-LF's
builtin types.

There are quite a few limitations right now. Most notably, variant and enum
types are not properly typed right now but rather gradually "typed" as
`unknown`. We also don't support nested `Optional`s, the `Numeric` type or
sum-of-product types in DAML. These issues are tracked in #3518.

There is currently one test. It takes a very simple DAML model, generates
the TypeScript for it and checks that it compiles and contains no linter
warnings/errors. Proper integration tests against the JSON API will follow.

* Address @cocreature's comments

* Make test work on Windows
2019-11-19 15:51:17 +00:00
Robin Krom
3d960c708f language: make only needed packages visible for cross sdk imports (#3503)
* language: make only needed packages visible for cross sdk imports

This gives us more control over what packages are visible in the package
database during cross sdk imports and makes sure we're not accidentally
picking up the wrong one.

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

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

* deal with evil dalf imports
2019-11-18 21:08:33 +00:00
associahedron
d654d7591b Improve Numeric type inference and safety by adding a scale constraint. (#3505)
* Add NumericScale typeclass

* Add release note
2019-11-18 13:53:17 +00:00
Moritz Kiefer
1370ef3083 Upgrade ghcide and haskell-lsp (#3499) 2019-11-18 10:56:19 +00:00
Martin Huschenbett
ab07b05fcb Clean up rules_daml (the bazel rules for DAML) (#3495)
There are rules that are used nowhere and seem like old cruft.
2019-11-18 08:12:47 +00:00
Moritz Kiefer
e2cd2c1fc9 Move packaging tests to a separate test suite (#3484)
* Move packaging tests to a separate test suite

Originally, we had these as part of the integration test suite since
`bazel run damlc build` couldn’t locate `ghc-pkg` but that has been
fixed for a while.

Moving it to a separate test suite speeds things up as the integration
tests are rerun very often and also makes development much more
convenient since the new test suite supports `-p` properly to filter
to specific tests.

For now, I’ve left the upgrading tests as part of the integration
tests. I expect that we probably want to factor those out to another
test suite as well.

* fix warnings
2019-11-15 12:45:37 +00:00
Remy
0e92bc6f61
add genmap in scenario service (#3483) 2019-11-15 12:39:48 +01:00
Andreas Herrmann
c994703c0c Update rules_haskell (#3473)
* Update rules_haskell & rules_nixpkgs

* Define dadew POSIX toolchain on Windows

* Build hpp with stack and Cabal

* Replace Hazel hpp by @stackage hpp

* replace backslash by forward slash

* Cabal wrapper exclude bindist includes

* ghci-grpc patch fix missing argument

* Switch to rules_haskell master
2019-11-15 10:50:12 +00:00
Remy
4d36c01682 Daml lf genmap (#3453)
* shortcup for SBMapEmpty

* daml-lf: add GenMap in the interpreter.
2019-11-15 10:36:41 +00:00
Moritz Kiefer
64261c80d6 Fix race condition in LSP stress tests (#3482)
Previously we opened file FooX before FooX+1 which we import from FooX
so there is a race condition if we try to resolve imports in FooX fast
enough. Now we open them in reverse order to fix this.

The other option would be to write all files to disk before opening
them but given that we can easily avoid this here, I’d rather keep
things in memory.
2019-11-15 09:27:39 +00:00
Moritz Kiefer
db1b12dbab Move packaging logic to a separate module (#3481)
It has grown large enough that by now it definitely deserves to be in
its own module.

This PR does not change any of the actual code, it simply moves it around.
2019-11-14 21:14:59 +00:00
Robin Krom
cd1533b270 language: fix for tuple types in source generation (#3449)
* language: fix for tuple types in source generation

We correct the source generation from dalfs containing TupleN data
types. A test is added to the integration tests of daml assistant and
the `generate-src` command is improved to make this test possible.

* check that tuple type comes from DA.Types

* check that compilation succeeded

* pattern match golf

* check for tuples between 2 and 20
2019-11-14 13:46:07 +00:00
Robin Krom
f2cc138204
language: reexport module in data dependencies (#3457)
This change allows to only import `module A` from the instances package
if data dependencies are present instead of  `module A` and `module
AInstances`.
2019-11-14 14:20:09 +01:00
associahedron
87de36a7fe Add GenMap support in the compiler. (#3437)
* Add GenMap support in the compiler.

* Add GenMap ticket number in Upgrade.hs
2019-11-13 13:05:53 +00:00
Martin Huschenbett
00afadeed8
Remove a bunch of unused CLI option parsers from damlc (#3440) 2019-11-13 13:27:31 +01:00
associahedron
faa960d6c6
Refactor alternatives in LF conversion. (#3434)
* Refactor alternatives

* Be explicit about simple record case in case conversion
2019-11-13 10:10:23 +00:00
Remy
6f5c5fd3b1 daml-lf: add GenMap to archive proto (#3431)
* add GenMap to archive proto

* Address Martin's comments

* Address Gerolf's comments
2019-11-12 14:25:19 +00:00
Moritz Kiefer
7db11ca427 Add toAnyContractKey and fromAnyContractKey (#3408)
* Add toAnyContractKey and fromAnyContractKey

This is necessary to add exerciseByKey to DAML triggers.

* Switch to proper ghc-lib release

* Remove unnecessary filter

* Bump timeout because macos is terrible

* bazel fmt
2019-11-11 17:35:53 +00:00
Martin Huschenbett
de14f0c53f Remove an inaccurate FIXME (#3412)
I didn't really read the code around the FIXME. After spending a few moments
on it, I'm now convinces the current behaviour is the right behaviour. I
can't think of a short way to explain it in a comment without inflicting my
my previous confusion on others. Thus, I just remove the FIXME.
2019-11-11 16:31:34 +00:00
Andreas Herrmann
c7038f128e Fix Bazel warnings (#3414)
* No longer depend on "@bazel_tools//tools/jdk:jar"

To avoid the following warnings
```
WARNING: /home/aj/.cache/bazel/_bazel_aj/c1e06e2358666d118d0ae50e2d32c25d/external/bazel_tools/tools/jdk/BUILD:124:1: in alias rule @bazel_tools//tools/jdk🫙 target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594)
```

* Targets and files should not share names

To avoid the warning
```
WARNING: /home/aj/tweag.io/da/da-master/compiler/damlc/tests/BUILD.bazel:316:1: target 'simple-dalf.dalf' is both a rule and a file; please choose another name for the rule
```
2019-11-11 15:41:34 +00:00
Andreas Herrmann
33e47828e3
Bazel 1.1 (#3249)
* bazel: 0.28.1 --> 1.1.0

* bazel-watcher sha256

* Fix missing line in patch

* proto_source_root --> strip_import_prefix

See https://github.com/bazelbuild/bazel/issues/7153 for details.

* Update rules_nixpkgs

Required to avoid errors of the form
```
ERROR: An error occurred during the fetch of repository 'node_nix':
   parameter 'sep' may not be specified by name, for call to method split(sep, maxsplit = None) of 'string'
```

and
```
ERROR: An error occurred during the fetch of repository 'node_nix':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149
		_execute_or_fail(repository_ctx, <3 more arguments>)
	File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail
		fail(<1 more arguments>)

Cannot build Nix attribute 'nodejs'.
Command: [/Users/runner/.nix-profile/bin/nix-build, /private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/node_nix/nix/bazel.nix, "-A", "nodejs", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/nixpkgs/nixpkgs"]
Return code: 1
Error output:
src/main/tools/process-tools.cc:173: "setitimer": Invalid argument
```

* Update rules_scala

* .proto has been removed, use [ProtoInfo] instead

See
https://docs.bazel.build/versions/1.1.0/be/protocol-buffer.html#proto_library

* python3_nix add nix_file attribute

To avoid the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/BUILD:66:1: //:nix_python3_runtime depends on @python3_nix//:bin/python in repository @python3_nix which failed to fetch. no such package '@python3_nix//': Traceback (most recent call last):
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149
                _execute_or_fail(repository_ctx, <3 more arguments>)
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail
                fail(<1 more arguments>)

Cannot build Nix attribute 'python3'.
Command: [/home/aj/.nix-profile/bin/nix-build, "-E", "import <nixpkgs> { config = {}; overlays = []; }", "-A", "python3", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/nixpkgs/nixpkgs"]
Return code: 1
Error output:
error: anonymous function at /home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/nixpkgs/nixpkgs.nix:3:1 called with unexpected argument 'config', at (string):1:1
```

* rules_haskell unnamed string.split(_, maxsplit = _)

The keyword argument may no longer be named.

* string.replace(_, _, maxsplit = _) may not be named

* Move proto sources from deps to data

Fixes

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/daml-lf/archive/BUILD.bazel:150:1: in deps attribute of scala_test rule //daml-lf/archive:daml_lf_archive_reader_tests_test_suite_src_test_scala_com_digitalasset_daml_lf_archive_DecodeV1Spec.scala: '//daml-lf/archive:daml_lf_1.6_archive_proto_srcs' does not have mandatory providers: 'JavaInfo'. Since this rule was created by the macro 'da_scala_test_suite', the error might have been caused by the macro implementation
```

* Define sha256 for haskell_ghc__paths

Bazel 1.1.0 fails on missing hashes.

* Disable --incompatible_windows_native_test_wrapper

* //compiler/daml-extension don't modify sources

Modifying sources in-place can cause issues on Windows, where build
actions are not sandboxed and changes on sources can affect other build
steps.

* bazel-genfiles --> bazel-bin

The bazel-genfiles symlink has been removed since Bazel 1.0.
See https://github.com/bazelbuild/bazel/issues/8651

* Mark dev_env_tool repository rule as configure

See
https://docs.bazel.build/versions/1.1.0/skylark/lib/globals.html#repository_rule

* Move data deps into data attribute

* Mark dev_env_tool as local = True

* Manually fetch @makensis_dev_env
2019-11-11 10:06:03 +01:00
Martin Huschenbett
6fe3df57cd Rewrite PRSelf when loading a dependency package (#3406)
When buidling simple project that has our favourite large project as a
dependency, this decreased
- total allocations from 63GB to 57GB
- run time from 34.0s to 31.5s
2019-11-11 08:52:07 +00:00
Moritz Kiefer
028dfcf6d4 Expose projection from contract key to maintainers (#3396) 2019-11-09 18:00:00 +00:00
Robin Krom
6cf3a5276f
language: introduce data-imports (#3399)
* language: introduce data-imports

Right now the user experience for importing dalfs and dars from
different sdks is quiet confusing. This PR tries to solve this. We add
an additional field `data-imports` to daml.yaml. These imports can come
from different SDK's and we will generate interface files containing the
data types and their Template instances.

This also simplifies the migration command, as it now always imports the
respective packages as `data-imports`.
2019-11-08 16:32:30 +01:00
Robin Krom
1bae7cdb7b language: support BTAny/BTTypeRep in upgrades (#3397) 2019-11-08 14:02:11 +00:00
Moritz Kiefer
48e71fb1e2 Add a test for transitive dependencies in incremental builds (#3392)
Given that I initialy messed this up during development (that’s where
the `reverse` in setting up the typecheck env comes from), it seems
like a good idea to have a test for this :)
2019-11-08 09:50:32 +00:00
Rohan Jacob-Rao
df112934c3
Check versions for types and nonemptiness before displaying release notes (#3368) 2019-11-07 16:59:40 -05:00
Moritz Kiefer
d7f5b3b436 Add support for on-disk incremental builds in damlc build (#3378)
* Add support for on-disk incremental builds in damlc build

* Normalise file paths of internal modules because Windows

* stop stealing my $s hlint

* Apparently jars are also called exe

* Address review comments

* Bump to proper ghcide revision
2019-11-07 16:56:42 +00:00
associahedron
e0ecbff72a LF conversion: Qualify every conversion rule. (#3381)
* Qualify the conversion rules

* Clean up Prelude.daml very slightly

* Move the patterns to UtilGHC.hs

* Lint
2019-11-07 16:12:54 +00:00
Robin Krom
85019835af language: dont change directory for generation of ifaces (#3379)
We don't need to change the directory to generate the interface files.
2019-11-07 15:52:17 +00:00
Remy
d39d7974fc daml-lf: freeze version 1.7 (#3340)
* daml-lf: freeze daml-lf 1.7

* speedy: remove useless double checks
2019-11-07 09:51:18 +00:00
Rohan Jacob-Rao
0ae016ddf1 Display release notes using webview (#3321)
* Display release notes using webview

* Use const and fix string

* Check for version upgrade before showing release notes

* Changelog entry

* Use node-fetch instead of web-request

* Remove spurious state update
2019-11-06 17:01:35 -05:00
Robin Krom
6943165c84
language: cross sdk dalf/dar imports (#3358)
* language: cross sdk dalf/dar imports

The final piece for cross sdk imports. With this PR we can import the
data types of packages and dalfs that were created with different sdks.

This is done by generating interface files from dalfs and an 'instances'
package that contains the template instance definitions of template data
types. The instances itself are defined via the `external` keyword,
which is inlined to proper daml-lf instance definitions given in the
respective dalf package.

We test that cross sdk imports work by importing the `simple-dalf` in
the daml-assistant integation tests and running a scenario.
2019-11-06 19:35:40 +01:00
associahedron
8a7c6cd94d Add support for single-constructor enum types. (#3345)
* Allow data A = A by prepending DamlEnum$ to type name.

* Single con enums basically work.

* Fix export lists for single constructor enum types.

* Revert "Fix export lists for single constructor enum types."

This reverts commit 7475a3dfbe3531d3ef62fdbcfe64c01a9e22d7af.

* Switch to a "stupid theta" approach

* Clean up enum type preprocessor

* Run enum preprocessor on generated code.

* Add daml-docs golden test for single constructor enums

* s/genPreprocessor/generatedPreprocessor/g

* Update copyright header

* Update release notes

* Remove unnecessary OverloadedStrings
2019-11-06 16:03:52 +00:00
Moritz Kiefer
bb15df1c7d
Add Applicative functions that ignore their results (#3354)
fixes #3315
2019-11-06 15:45:33 +01:00
Robin Krom
f4960603c9
language: dont hide modules without aliases (#3356)
Currently we hide modules, for which we don't define an alias, when we
specify one alias for *one* module. With this change, all modules
without aliases are still exposed.
2019-11-06 15:17:50 +01:00
Robin Krom
cff6db7b31
language: refactoring of iface file generation and package db setup. (#3342)
* language: refactoring of iface file generation and package db setup.

This is a refactoring of the damlc part that creates the package
database and the code generation for interface files. This is a
preparation for the cross sdk imports.
We also add an internal command to damlc to generate generic instances
code and use simple copying via {..} in the migration command. An
additional test checks that migration via generics still works.

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

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

* clearer description for generate-gen-src

* updated documentation

* correct copy/pasta mistake

* added a comment on different build options in migration command.

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

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

* resolve dalf paths from dar manifest

* added a comment on different headers in upgrade modules.

* removed monoid instance for ExtractedDar
2019-11-06 12:23:58 +01:00
Robin Krom
a8c498abcd
language: add an option to add an archive choice to the simple dalf (#3338)
This adds a flag to add an archive choice to the simple dalf so we can
test with and without archive choice.
2019-11-05 14:45:18 +01:00
mziolekda
0a2641ba78
Remove dead dependency on jboss logging library (#3333)
* remove dead dependency om jboss logging library

* remove references to jboss from license file
2019-11-05 11:36:43 +01:00