Commit Graph

233 Commits

Author SHA1 Message Date
Remy
439613bee8 daml-lf: add FROM_TEXT_INT64 and FROM_TEXT_DECIMAL (#1407)
* daml-lf: add FROM_TEXT_INT64 and FROM_TEXT_DECIMAL

* Fix typos in Haskell

* cosmetic change

* Fix DAML-LF type checker

* Fix merging fallout
2019-05-27 17:19:01 +00:00
Martin Huschenbett
34d436d77d Drop support for DAML-LF 1.1 from damlc (#1231)
* Drop support for DAML-LF 1.1 from damlc

Part of #853.

* Fix docs test

* Add show party test back

* Update release notes

* Remove target version from Java codegen test
2019-05-27 16:07:35 +00:00
Martin Huschenbett
c30ec0fc03
Make the actors optional in DAML-LF's exercise instruction (#1377)
* Make the actors optional in DAML-LF's exercise instruction

If they are not present, the controllers will be filled in. Surface DAML
does this currenty anyway by fetching the contract and computing the
choice controllers before each `exercise`. This change will allow for
getting rid of the additional `fetch` preceding each `exercise`.

The compiler does not use the new form yet. I will do this in a separate
PR together with tests for the new behaviour.

This fixes #1347.

* Fix DAML-LF type checker test

* Check presence of actors for old DAML-LF versions in decoder
2019-05-24 15:01:56 +02:00
Martin Huschenbett
b09cbd037b
Add coerce for contract ids to DAML-LF (#1346)
* Add coerce for contract ids to DAML-LF

This is needed for our implementation plan for generic templates.

Fixes #1277.

* Reformat Scala
2019-05-24 09:08:15 +02:00
Moritz Kiefer
1c580d84a5
Make exposed-modules field in daml.yaml optional (#1345)
If unspecified, we expose all modules in the project.

Fixes #1328
2019-05-23 15:37:37 +02:00
Martin Huschenbett
8ec03875c6
Lift restriction on serializable contract ids in DAML-LF 1.dev (#1315)
* Lift restriction on serializable contract ids in DAML-LF 1.dev

In DAML-LF 1.dev, make `ContractId a` serializable whenever `a` is
serializable. This is part 2 of #1277.

* Reformat Scala

* Add changelog entry to daml_lf_1.proto
2019-05-22 22:23:59 +02:00
Martin Huschenbett
6e73868220 Replace all occurrences of Tagged in DAML-LF AST with newtypes (#1289)
* Replace all occurrences of Tagged in DAML-LF AST with newtypes

This must end as it makes the code bases harder to understand without
adding any benefits.

* Add two more usages of mkVal

* Remove Orphans.Lib_hashable

* Remove tagged from package dependencies

* Derive stock classes as such
2019-05-21 16:19:57 +00:00
Martin Huschenbett
ee02c9ee6e Make DAML-LF 1.4 the default version output by damlc (#1283)
* Make DAML-LF 1.4 the default version output by damlc

This removes the syntactic restriction on contract keys.

* Add DAML-LF 1.4 to release notes
2019-05-21 14:33:44 +00:00
Martin Huschenbett
24e305c1af Relax syntactic restriction on contract keys in DAML-LF 1.dev (#1219)
* Relax syntactic restriction on contract keys in DAML-LF 1.dev

We lift the syntactic restriction that contact keys must be built using
only record constructions and projections entirely when compiling to
DAML-LF 1.dev. To make this more useful, we also search all sub-expressions
of `maintainer` in `key` during our rewriting of `maintainer` for using
`this` to using `key`.

As one of our next steps we should bring `key` into scope in `maintainer`
and perhaps deprecate the use of `this` at some point in the future.

* Fix versioning

* Adapt package validation to complext contract keys
2019-05-17 20:06:23 +00:00
Martin Huschenbett
491e572f62 Turn a few standalone deriving clauses into proper deriving clauses (#1220) 2019-05-17 12:37:09 +00:00
Martin Huschenbett
c11c565ea4
Move the DAML-LF version render/parse logic into LF.Version (#1190) 2019-05-16 16:35:54 +02:00
Martin Huschenbett
02d61cc48f
Rename render/parse functions for DAML-LF minor versions in Haskell (#1182)
The current naming suggests, the protobuf encoding and the CLI use different
textual representations of minor versions, which is not true. They only
differ in their types. We push this type conversion to the call sites
of both functions instead.
2019-05-16 14:58:10 +02:00
Martin Huschenbett
415e76b8c6 Test DAML-LF version 1.dev in damlc integration tests (#1135)
Currently, we test the default and the newest DAML-LF version. After the
recent introduction of 1.dev, this doesn't make sense anymore. Instead, we
now test the default version (which should always be the newest version)
and the dev version.
2019-05-15 15:49:22 +00:00
Moritz Kiefer
a0338bdc6a Move moduleNameString to DA.Daml.LF.Ast.Util (#1065) 2019-05-10 10:41:55 +02:00
Moritz Kiefer
218bd691f2 Fail if modules listed in exposed-modules are not in the DALF (#1054)
fixes #1041
2019-05-10 02:37:27 +00:00
Neil Mitchell
fe3e5c9639
Delete DA.Prelude (#914)
* Use DA.Prelude a lot less

* Make LANGUAGE pragmas have the right case

* Don't reexport DA.Prelude

* Remove more DA.Prelude imports

* Remove the nastiest renaming DA.Prelude

* Final removal of DA.Prelude

* Kill DA.Prelude

* Add missing dependencies

* More missing package imports

* More missing package imports

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

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
2019-05-04 18:51:56 +01:00
Stephen Compall
f5490a5454 add LF 1.dev "minor dev version" (#709)
* clean up v3 contract key case in TransactionVersions

* clean up duplicate cases in ValueVersions.assignVersion

* make LanguageMinorVersion a proper ADT, aliased LanguageVersion.Minor

* port DecodeV1 to LanguageMinorVersion ADT via implicit conversion

- @remyhaemmerle-da might prefer the explicit application of Stable/Dev

* make releasePrecedes private

* add dev versions to the timeline

* copyright header for LanguageMinorVersion

* build the package database for 1.dev, support 1.dev as --target

* test presence and new-ness of "dev" in timeline

* report dev versions in engine info; note 1.dev target in release notes

* spec and governance rules on 1.dev and minor dev in general

* make the governance rule about dev more direct

* 1.x

* missed plural; thanks @leo-da

* further definition of 1.dev in LFv1 spec; thanks @remyhaemmerle-da
2019-05-03 10:36:45 +02:00
Martin Huschenbett
df230912c7
Drop DAML-LF 1.0 support from compiler (#863)
* Drop DAML-LF 1.0 support from compiler

This will enable us to add `Functor`, `Applicative` and `Monad` instances
for `(->) r` in the `daml-stdlib`. We'll do this in a separate PR.

* Remove codegen test for DAML-LF 1.0
2019-05-02 21:35:06 +02:00
Neil Mitchell
0b184ee3b6 Deal with NUL bytes in strings (#844)
* Make all Text tests be qualified to Scenario

* Remove the big list of tests from Text test

* Add DA.Text.reverse

* Move LitString decoding out to UtilGHC

* Rename the functions to match their GHC counterparts

* Fix pretty printing of LF strings containing weird characters, e.g. NUL or "

* Move to using an unpackCStringUtf8 which copes with GHC-style nuls

* Add lots of tests around NUL characters

* Use a safer CString function
2019-05-02 17:33:07 +00:00
Neil Mitchell
536b1ea87f Explicit export lists in the DAML-LF Haskell module (#813)
* Delete an entirely unused module

* Delete an entirely unused module

* Switch the compiler to use EUnit over mkEUnit

* Delete an unused module

* Whitespace only

* Clean up the API for World, don't expose the internals, better creation functions

* Clean up the type checker environment, don't expose the internals of Gamma, add a few helper functions

* Delete unused functions

* Explicit module export lists

* Fix the nub replacement hints

* Turn on the warning that we require module export lists

* Add an explicit export list
2019-05-02 10:12:31 +02:00
Neil Mitchell
5ed95bc64c
Move DA.Pretty into da-hs-base (#818)
* Move DA.Pretty into da-hs-base

* Bazel formatting

* Remove another instance of da-hs-pretty
2019-05-01 14:50:19 +01:00
Martin Huschenbett
06514c0382
Remove a few unused functions from DA.Daml.LF.Ast.Util (#805)
* Remove a few unused functions from DA.Daml.LF.Ast.Util

Most of them were used in the old DAML 1.0 to DAML-LF compiler.

* Make hlint happy
2019-04-30 20:47:32 +02:00
Martin Huschenbett
9dd8a4646e
Remove a few unused lenses and prism for the DAML-LF AST (#803)
This reduces our Template Haskell footprint.
2019-04-30 20:47:12 +02:00
Stephen Compall
a3e9aad147
remove major LF dev version (#681)
* removing major LF dev version from Haskell proto codecs

* removing major LF dev version from scenario service client

* missed import

* remove Scala support for dev major version; remove --allow-dev option from sandbox cli

* Version.minorFromCliOption function

* don't build daml-stdlib artifacts for dev major

* remove damlc CLI --target dev

* release note about removed dev major LF version

* governance now discusses minor dev, no more major dev

* don't build from daml_lf_dev.proto anymore

* remove daml_lf_dev.proto

* raise deprecated release

* reserve 9999 in the ArchivePayload sum, as suggested by @bitonic

* use reserved proto keyword, as suggested by @bitonic

- `reserved` cannot occur within `oneof` block

* remove --allow-dev test

* dev removal release note followed the previous release; move it back to HEAD
2019-04-26 13:10:09 -04:00
Martin Huschenbett
fffd8d03e8 Stop using Template Haskell to derive type class instances (#262)
* Stop using Template Haskell to derive type class instances

Template Haskell is notorious for causing slow build times. That's why we
remove the `makeInstances*` family of functions and use proper `deriving`
clauses instead.

* Make hlint happy

* Make hlint even more happy

* Derive Data

* Remove ToJSON instances from DAML-LF AST
2019-04-25 16:35:35 +02:00
Martin Huschenbett
eb049869f6
Clean up how we check DAML-LF feature support in damlc (#663)
* Clean up how we check DAML-LF feature support in damlc

Currently, we have a predicate that tells us whether a DAML-LF version
supports a specific feature. We replace this by a data type which captures
the name of a feature and the minimal DAML-LF version which supports it.

* Rename featureDisjunctionChoices into featureFlexibleControllers

* Error only once

Co-Authored-By: hurryabit <martin.huschenbett@posteo.me>
2019-04-25 14:41:35 +02:00
Francesco Mazzoli
a504bbdc9e make DAML-LF 1.3 the default (#654) 2019-04-25 08:10:44 +00:00
Martin Huschenbett
968bca7589 Check that contract keys are supported in DAML-LF type checker (#639)
Add a check to the Haskell implementation of the DAML-LF type checker to
make sure that the current DAML-LF version supports contract keys when they
are encountered.
2019-04-24 09:17:15 +00:00
gleber
aa70c7f64e
Enforce consistent formatting of BUILD files. (#412)
* Add buildifier targets.

The tool allows to check and format BUILD files in the repo.

To check if files are well formatted, run:

    bazel run //:buildifier

To fix badly-formatted files run:

    bazel run //:buildifier-fix

* Cleanup dade-copyright-headers formatting.

* Fix dade-copyright-headers on files with just the copyright.

* Run buildifier automatically on CI via 'fmt.sh'.

* Reformat all BUILD files with buildifier.

Excludes autogenerated Bazel files.
2019-04-12 13:10:16 +02:00
Martin Huschenbett
667a63a9b1
Add location information to DAML-LF produced by damlc (#390)
* Add location information to DAML-LF produced by damlc

This is required to get error locations in the scenario view. Rigth now,
the location information for `create`/`exercise` still points to the
template/choice. I'll fix that in a separate PR.

* Fix test expectations

* Fix more tests
2019-04-11 21:44:48 +02:00
Jussi Mäki
1f2246c822 Do not divulge contracts to observers in nonconsuming exercises (#325)
* Do not divulge contracts to observers in nonconsuming exercises

Disables support for non-default ledger feature flags, as they
are meaningless since ledger server logic does not respect the flags.
Instead of large refactoring to add support for the old flag settings,
it is best to disallow the deprecated flags, and later on phase out the
flags completely.

Re-enables test_divulgence_of_token in sandbox semantic tests.

Fixes #157.

* purge LedgerFlags entirely...

...since we only support one version of them anyway, and clearing them

* updated release notes
2019-04-11 14:41:35 +02:00
Martin Huschenbett
7c3cd8840b
Remove DefValueInfo data type (#252)
This was used by the old DAML-LF based record constructor/projection
inliner. We'bve recently replaced by an inlining mechanism which is part
of the conversion from GHC Core to DAML-LF.
2019-04-05 16:47:08 +02:00
Digital Asset GmbH
05e691f558 open-sourcing daml 2019-04-04 09:33:38 +01:00