Commit Graph

728 Commits

Author SHA1 Message Date
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
Martin Huschenbett
dff3edfd26 Add assertEq and assertNotEq to DA.Assert (#3318)
* Add assertEq and assertNotEq to DA.Assert

I prefer named functions over infix operators.

* Adapt doctest integration test
2019-11-04 22:48:46 +00:00
Remy
7d8a484ce9
daml-lf: prepare release of LF 1.7 (#3329)
* daml-lf: prepare release of LF 1.7

* add comment
2019-11-04 22:57:35 +01:00
Remy
7c427119e1 DAML-LF add Type Representation value (#3326)
* daml-lf: update spec with type-rep

* daml-lf: update proto with type-rep

* daml-lf: update scala side with TypeRep

* daml-lf: update compiler side with TypeRep

* Get triggers to compile

* Add featureTypeRep to allFeatures

* Apply suggestions from code review

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

* daml-lf: add builtin for TypeRep equality

* Address Andrea's comments

* formatting

* Fix triggers

* Fix template typerep tests
2019-11-04 17:00:55 +00:00
Shayne Fletcher
c8a9e0b295 Update hlint; add some dlint smoke tests (#3319) 2019-11-01 18:29:51 +00:00
Remy
d56a4aa715 Intern all strings: proto cleanup (#3296)
* daml-lf: cleanup strings/names interning for 1.dev

* change level of dottedName intening
* make interning mandatory
* rational name of proto field

* fix tests

* spec update

* fix test

* formatting

* Address Gerolf's comments

* Address Jussi's comments
2019-11-01 17:03:42 +00:00
Moritz Kiefer
bd19291632 Fix superclass detection for Numeric (#3316)
For numeric, the superclass dicts can be of the for `dict @10` so only
handling variables doesn’t work. Now we walk down applications and
check the name on the left.
2019-11-01 16:15:23 +00:00
Rohan Jacob-Rao
8ec9c324fb Store extension version in global state (#3309)
* Store extension version in global state

* Fix synchronicity
2019-10-31 21:18:11 +00:00
Shayne Fletcher
11c1bf0fba
Upgrade hlint (#3306) 2019-10-31 15:08:21 -04:00
Martin Huschenbett
6211d74193 Add filter function to TextMap and Next.Map (#3305)
This closes #2760.
2019-10-31 15:41:32 +00:00