Commit Graph

307 Commits

Author SHA1 Message Date
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
Robin Krom
ca87b9c601
language: some small fixes to the daml source gen from dalfs. (#3151)
Two changes: Make sure `DA.Internal.Tempalte` is imported is necessary
and convert variants with unit argument correctly.
2019-10-14 11:44:25 +02:00
associahedron
bcf4aff2ab
damldocs: Do not filter templates and choices by export set (#3161)
* Do not filter choices or template fields by export list

* Add Template0
2019-10-14 09:43:18 +01:00
Moritz Kiefer
48eb360a4f Add AnyChoice type to DAML (#3152)
* Add AnyChoice type to DAML

fixes #3131

* Fix ProposalDesugared

* Fix trigger tests

* Use the proper ghc-lib urls
2019-10-10 16:46:55 +00:00
associahedron
172996e4db Restrict type-level nats to [0,37]. (#3139)
* Restrict type-level nats to [0,37]

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

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-10-10 12:20:24 +00:00
Robin Krom
09fa4cf588
language: fix: don't look for daml files in hidden directories (#3144)
* language: fix: don't look for daml files in hidden directories

Fixes #3134. When locating daml source files, we need to make sure we're
not recursing into the .daml directory, because it contains source files
of the dependencies.

* Update daml-assistant/integration-tests/src/Main.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2019-10-10 12:33:19 +02:00