Commit Graph

512 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
associahedron
76531c93bf Expose generic equality in compiler (#3815) 2019-12-11 12:15:52 +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
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
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
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
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
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
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
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
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
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
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
Moritz Kiefer
8615266230 Switch the default DAML-LF version to 1.7 (#3530) 2019-11-19 19:18:07 +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
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
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
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
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
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
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
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
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
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
associahedron
8c8cd5f433 Refactoring the handling of data types in LFConversion.hs (#3251)
* Add some type signatures to make MonoLocalBinds happy

* Extract applyDataCon function

* rename applyDataCon

* Refactor convertDataCon

* ß reduction

* Delint

* Refactor convertTypeDef

* Rewrite convertTemplateInstanceDef

* pass sanitization function to convertRecordFields

* Extract out the newtype worker definition

* Move mkWorkerName to UtilLF

* Simplify getTag conversion

* Simplify tagToEnum# conversion

* Eliminate Ctors and toCtors

* Reviewer comments
2019-10-31 13:46:48 +00:00
Remy
5812a1246d
daml-lf: to_text_template_id -> to_text_type_con_name (#3293)
* simplify to_text_template_id

* to_text_template_id -> to_text_type_con_name
2019-10-30 17:32:36 +01:00
Martin Huschenbett
8cfbd50c17 Don't cache the GHC Core produced during compilation (#3269)
* Don't cache the GHC Core produced during compilation

In our experiments, this reduced the memory footprint by ca. 18% on a very
big code base.

* Adapt integration tests

* Fix integration tests
2019-10-29 15:30:59 +00:00
Rohan Jacob-Rao
00fc6bf100 Log when user views scenario results (#3271)
* Extend Priority type with Telemetry value

* Include Telemetry logging level in logger

* Log viewing of scenario results

* Update ghcide with telemetry logging level
2019-10-28 23:42:20 +00:00
Robin Krom
d4f8db05f0
language: parse sdk version from manifest (#3262)
This is in preparation for the support of cross sdk imports, where we
need to know whether imports have different sdk versions or not.
2019-10-28 17:45:06 +01:00
Andreas Herrmann
dc2f10ebe6 Use TemplateTypeRep in DAML Trigger API (#3245)
* Add TemplateTypeRep to AnyContractId

* Define Trigger.ContractId t

* Use Trigger.ContractId t

* Implement fromCreated and fromArchived

* instance MapKey TemplateTypeRep

* More efficient ACS access using Map TemplateTypeRep

* ./fmt.sh

* toString and fromString for Identifier

* Replace Identifier by TemplateTypeRep

* TheContractId --> AbsoluteContractId

https://github.com/digital-asset/daml/pull/3245#discussion_r338033546
2019-10-23 13:56:59 +00:00
Moritz Kiefer
319d43ac26
Clear package db before reinitializing it (#3241)
fixes #3240
2019-10-21 14:04:10 -04:00
Andreas Herrmann
4a5b74b93d
Warn if module name mismatches file name (#3228)
* Test: Warn if module name mismatches file name

* Update ghcide

* Add module name mismatch preprocessor
2019-10-21 13:17:41 +02:00
associahedron
1d52cdb4bc
Add damlc test to list of cammands that care about build-options (#3227) 2019-10-21 11:36:21 +01:00
Shayne Fletcher
040a4531de
Update DLint (#3234) 2019-10-21 05:31:58 -04:00
Shayne Fletcher
3e17d482c3
Update DLint; welcome pattern rules (#3230) 2019-10-18 12:19:29 -04:00
Moritz Kiefer
525521a850 Only match identifiers from DA.Internal.LF if they are in the right module (#3220) 2019-10-18 10:37:01 +00:00
Moritz Kiefer
36719717fa
Update to current state of progress reporting in LSP (#3211)
* Update to current state of progress reporting in LSP

* fix ide-debug-driver

* Fix tests

* Fix build of ghcide executable
2019-10-17 16:14:49 +02:00
associahedron
a90a1e1e8e Add Numeric support to migrate. (#3195)
* Add Numeric support to migrate

* Generate GHC.Types definitions based on LF version.

* Add a migration test with Numerics.
2019-10-16 15:56:49 +00:00
Remy
506a3be6e5 Revert "Revert "Intern all strings and dotted names in the DAML-LF protobuf encoding (#3067)"" (#3120)
This reverts commit 4596c1bde6.
2019-10-16 12:12:07 +00:00
Robin Krom
29424af721
language: dalf imports and a test (#3176)
* language: dalf imports and a test

This adds the possibility to directly import dalfs in a project. We test
that we can import the `simple-dalf` in the daml-assistant integation
tests. For now we only check that data type generation works, not yet
the template instance.

The following was fixed: When rewriting package self references, this
changes the hash of the package later on and leads to different package
hashes. Also we need to be careful to write the orignal binary
representation to this and not re-encode it because the encoding might
have changed with a different sdk.

* addressing moritz's comments.

* windows doesnt like bazel paths
2019-10-15 17:20:53 +02:00
Andreas Herrmann
3a94812b97 Test templateTypeRef across modules (#3185) 2019-10-15 15:04:30 +00:00
Moritz Kiefer
b568827563
Add createAndExercise to the standard library (#3182) 2019-10-15 15:03:25 +02:00
Andreas Herrmann
a49c6469c7 Implement templateTypeRep in DAML (#3174)
* Improve comment

https://github.com/digital-asset/daml/pull/3118#discussion_r332894977

* Implement templateTypeRep in DAML

* TemplateTypeRep tests: use === and =/=

https://github.com/digital-asset/daml/pull/3174#discussion_r334775937

* Switch to bintray ghc-lib 20191015
2019-10-15 10:08:41 +00:00
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
d64df4b5f7 daml-lf: clean achive bazel build (#3175)
* clean the mess in daml-lf achive bazel build

* add release note

* Address Moritz's comments

* more release notes
2019-10-15 08:36:46 +00:00
associahedron
70b025b691 damldocs: change External:Archive to Archive in template docs (#3165)
* damldocs: change External:Archive to Archive in template docs

* Update tests
2019-10-14 16:32:13 +00:00
Remy
217405e883 daml-lf: Move archive protofile to a more usual place. (#3166)
* move daml-lf archive protobug to a more usual place

* formatting

* fix kvutils proto

* fix csharp namespace
2019-10-14 13:22:22 +00:00