Commit Graph

79 Commits

Author SHA1 Message Date
Remy
6c1f404c7d
LF: Add TO_TEXT_BIGNUMERIC (#9276)
This is part of #8719.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-30 13:31:42 +02:00
Remy
51c5eac66e
LF: Add BigNumeric to archive proto (#9210)
CHANGELOG_BEGIN
CHANGELOG_END
2021-03-23 13:58:22 +00:00
Remy
2551b2d615
LF: Add BigNumeric and Rounding to Scala AST (#9205)
This advance the state of #8719

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-23 09:16:27 +01:00
Remy
70379d4e85
LF: Experiment Hook for 1.dev (#9051)
This PR adds a hook in the compiler and the engine to allow easy prototyping of new features.

In particular by using this hook, one can add a new feature in 1.dev with modifying:

    compiler
    type checkers (both Haskell and Scala)
    archive Protobuf
    archive decoder

In addition of development speed, this also adds a bit of confidence, as the peaces enumerated above are not touched when adding the feature: The feature can be added by modifying only 1.dev Daml standard library and Speedy.

aa7991f8 shows a use case of this hook.

CHANGELOG_BEGIN
CHANGELOG_END
2021-03-11 21:36:49 +01:00
nickchapman-da
dbd017ee49
Support exceptions in speedy. (#8612) 2021-02-15 11:07:12 +00:00
Moritz Kiefer
22ce940954
Upgrade scalafmt and enable trailing commas (#8437)
This PR updates scalafmt and enables trailingCommas =
multiple. Unfortunately, scalafmt broke the version field which means
we cannot fully preserve the rest of the config. I’ve made some
attempts to stay reasonably close to the original config but couldn’t
find an exact equivalent in a lot of cases. I don’t feel strongly
about any of the settings so happy to change them to something else.

As announced, this will be merged on Saturday to avoid too many conflicts.

changelog_begin
changelog_end
2021-01-09 11:37:37 +01:00
Moritz Kiefer
02d8e8fe95
Port //daml-lf/(parser|validation) to Scala 2.13 (#8391)
* Port //daml-lf/(parser|validation) to Scala 2.13

changelog_begin
changelog_end

* Rename (Expr|Type)Traversable to (Expr|Type)Iterable

changelog_begin
changelog_end
2021-01-05 13:11:27 +01:00
Remy
ae915b8dee
LF: Scala type checker handle exceptions (#8364)
* LF: Scala type checker handle exceptions

This includes some fixes of the DAML-LF specifications.

This is part of #8020.

CHANGELOG_BEGIN
CHANGELOG_END
2021-01-04 13:47:15 +01:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Remy
063ce6dc0f
LF: update LF parser with exceptions (#8332)
CHANGELOG_BEGIN
CHANGELOG_END
2020-12-18 13:06:24 +01:00
Remy
a8c4f1661b
LF: Add exceptions to Scala DAML-LF AST (#8312)
This advances states of #8020.

CHANGELOG_BEGIN
CHANGELOG_END
2020-12-17 17:45:32 +01:00
Moritz Kiefer
7e05dc7932
Upgrade rules-scala and scalatest (#8187)
This is necessary to at least attempt an upgrade to 2.13 and
generally, I want to keep our rulesets up2date. rules-scala forces the
version of scalatest so we have to bump that at the same time.

This requires changes to basically all Scala test suites since the
import structure has changed and a bunch of things (primarily
scalacheck support) got split out.

Apologies for the giant PR, I don’t see a way to keep it smaller.

changelog_begin
changelog_end
2020-12-08 06:59:23 +01:00
Samir Talwar
88cb4c0981
daml-lf: Include position information in the testing parsers. (#8182)
So it's easier to figure out where I've gone wrong.

CHANGELOG_BEGIN
CHANGELOG_END
2020-12-07 12:33:00 +00:00
Remy
41543ad161
LF: drop support for Exercise's actors (#8071)
This is a first set toward dropping support of deprecated LF version
(#7155).

CHANGELOG_BEGIN
CHANGELOG_END
2020-11-26 14:38:16 +01:00
nickchapman-da
fd5db0cfd7
choice observers, prep (#7548)
* choice observers, WIP

changelog_begin
changelog_end

fix generator driven test

Node.isReplayedBy, consider observers

add observers to NodeExercise in transaction.proto

add observers to TemplateChoice in Ast.scala

add observers to LF .proto, and Haskell Ast for TemplateChoice

reinstate trailing // for better format

fix validate tests

fix haskell LF decoder when choice-observers field is missing in .proto

fix build

make choice-observers optional in scala AST

make choice-observers optional in Haskell Ast

address comments from Remy and Martin

more review comments

check TransactionVersions.minChoiceObservers in Transaction encode/decode

featureChoiceObservers, and check in haskell type-checker

improve speedy Compiler for empty choice-observers

extend scala LF decoder for optional choice observers

extend scala parser for choices to allow optional choice-observers clause, and test

rename new field in scala Ast -> "choiceObservers"

var rename

extend TypingSpec tests for choice-observers. also add missing negative test for controllers

switch from keyword "ob" to identifier "observers" in scala parser choice syntax

add TODO for featureChoiceObservers to be part of DAML 1.9 (issue 7139)

* replace "NICK" comment markers with "FIXME #7709" comment markers
2020-10-21 11:15:18 +01:00
nickchapman-da
b7f8e3a812
Regularize scala mod-parser syntax for controllers (#7748)
* Regularize scala mod-parser syntax for controllers in preparation for adding choice-observers.

From keyword "by" to identifier "controllers" + leading ","

changelog_begin
changelog_end

* fix another use of the old "by" syntax -> ", controllers"
2020-10-20 16:16:45 +01:00
Remy
0bb378690d
LF: Add ExerciseByKey Update (#7663)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-14 12:06:36 +02:00
Remy
dc34d4f637
LF: add PackageInterface a lightweigh Package (#7577)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-13 12:41:22 +02:00
Remy
ea2a637a11
LF: decouple template from record in the Scala Ast. (#7631)
CHANGELOG_BEGIN
CHANGELOG_END
2020-10-12 11:28:30 +02:00
Remy
31f274ebca
LF: force actor field in Exercise Update to be undefined. (#7578)
* LF: force `actor` field in Exercise Update to be undefined.

This PR forces the field 'actor' from 'Upate.Exercise' to be undefined
starting from LF 1.5.

This breaking change is approved by Bernhard Elsner and Shaul Kfir.

It will affect only handcrafted LF archives, as no compiler from SDK
1.0.0 or latter made use of this field.

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-07 14:42:10 +02:00
Remy
d08de60d9c
LF: prevent duplicate fields in Struct (#7299)
CHANGELOG_BEGIN
CHANGELOG_END
2020-09-03 16:07:38 +02:00
Remy
ada8ba033b
LF: ad-hoc data struct to store LF Struct like data (#7220)
A `Struct[+X]` is a list of pair `(FieldName, X)` ordered by first
component.

We use this data-structure to represent TStruct LF type.

It will be used in upcomming PRs to sorted fields in Struct values.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-26 12:18:18 +02:00
Moritz Kiefer
ab8b418b72
Add TO_TEXT_CONTRACT_ID primitive (#7137)
* Add TO_TEXT_CONTRACT_ID primitive

This is the first part of #7114.

This PR

* Adds the primitive to the protobuf.
* Handles decoding and encoding in Haskell and Scala.
* Handles typechecking in Haskell and Scala.
* Handles speedy compilation and interpretation in Scala.
* Updates the specification.

This PR does not yet change the standard library to make use of this
primitive.

changelog_begin
changelog_end

* Apply suggestions from code review

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Avoid extra allocation

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-08-17 08:39:16 +00:00
Remy
17926c5a8a
LF: move language version from modules to packages (#7064)
CHANGELOG_BEGIN
CHANGELOG_END
2020-08-10 11:26:58 +02:00
Martin Huschenbett
3c1e8c7748
daml-lf/parser: Add the ability to parse location annotations (#6932)
* daml-lf/parser: Add the ability to parse location annotations

Currently, the DAML-LF parser we use for testing in Scala land does not
understand location information and has in particular no way to produce
`ELocation` AST nodes. Having these nodes will be important in a test
for a feature I'm currently working on in order to demonstrate that my
Speedy AST transformation can actually look through location
information properly.

This PR adds a rule to the parser to allow for parsing location
information and producing `ELocation` nodes.

CHANGELOG_BEGIN
CHANGELOG_END

* Address Nick's feedback

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-30 15:29:00 +00:00
Stephen Compall
a51d0db8ff
set scalac -Xsource:2.13 -Ypartial-unification globally (#6469)
* add -Xsource:2.13, -Ypartial-unification to common_scalacopts

* add now-referenced scalaz-core where needed

* work around bad type signatures in scalatest Aggregating, Containing

* unused Any suppression

* work around bad partial-unification wrought by type alias

* remove unused Conversions import

- not required in 4f68cfc480 either, so unsure how it's survived this long

* work around Future.traverse; remove unused show import

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove unused bounds

* remove -Ypartial-unification and -Xsource:2.13 where they were explicitly passed

* longer comment on what the options do

- suggested by @stefanobaghino-da; thanks

* forget Future.traverse, just use scalaz, it knows how to do this
2020-06-24 16:51:24 -04:00
Leonid Shlyapnikov
51d96a7d2e
Upgrading to scalac/runtime v2.12.11, we have been on v2.12.6 for too long (#5807)
https://github.com/scala/scala/releases/tag/v2.12.11

Fixing scalac deprecation and unused variable warnings

`/:` is deprecated, using foldLeft
`:\` is deprecated, using foldRight

Removing unused deps reported by bazel buildozer + scalafmt

changelog_begin
Upgraded Scala compiler and Scala runtime to v2.12.11.
See https://github.com/scala/scala/releases/tag/v2.12.11
changelog_end
2020-05-01 11:37:07 -04:00
Remy
50694c7abe
DAML-LF. fix parameter and self binder in choices. (#5444)
* DAML-LF. fix parameter and self binder in choices.

* fix

* DAML-LF: address moritz's comments

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-06 14:32:30 +00:00
Gerolf Seitz
a2d785e3ee
Use com.daml as root package (#5343)
Packages com.digitalasset.daml and com.daml have been unified under com.daml

Ledger API and DAML-LF DEV protos have also been moved from `com/digitalasset`
to `com/daml` on the file system.
Protos for already released DAML LF versions (1.6, 1.7, 1.8) stay in the
package `com.digitalasset`.

CHANGELOG_BEGIN
[SDK] All Java and Scala packages starting with
``com.digitalasset.daml`` and ``com.digitalasset`` are now consolidated
under ``com.daml``. Simply changing imports should be enough to
migrate your code.
CHANGELOG_END
2020-04-05 19:49:57 +02:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Stephen Compall
8d2c13cf43
generating GenMaps for testing (#5115)
* building a GenMap generator

* move Party Order to accessible place; test whether Name Equal is still in use

* add Order instance for SortedLookupList

* switch to Map for genMap's Inj; more Order instances

* remove all Order from TypedValueGenerators

* Revert "add Order instance for SortedLookupList"

This reverts commit 03a59a8249.

* moving the Equal instance means scenario-interpreter no longer direct-deps scalaz

* add a test using TypedValueGenerators GenMap

* remove Party Order

* refmt bazel

* remove stray import

* followup dep change to moving the Equal[Name] instance

* add changelog

CHANGELOG_BEGIN
CHANGELOG_END

* Name equal instance appears to be no longer used, but keeping anyway
2020-03-25 10:28:06 -04:00
Remy
ac8554eddd
Engine: drop old internal comparsion builtin (#4990)
* Engine: drop old internal comparison builtin

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-16 15:15:32 +01:00
Remy
c76e0bc1e0
DAML-LF add support for generic comparison in archive (#4983)
* DAML-LF: add generic comparison to archive
2020-03-13 20:13:13 +01:00
Moritz Kiefer
d68d3eb74a
Freeze DAML-LF 1.8 (#4770)
* Freeze DAML-LF 1.8

Two minor points that I did not mention in the previous PR:

We also include the renaming of structural records to `struct` and the
renaming of `Map` to `TextMap`.

There are some minor changes around the LF encoder tests which need to
be able to emit package metadata properly so I’ve added it to the
parser. Sorry for not splitting that out.

Following the process used for the DAML-LF 1.7 release, this does not
yet include the frozen proto file.

changelog_begin

- [DAML-LF] Release DAML-LF 1.8:

  * Rename structural records to ``Struct``. Note that
    structural records are not exposed in DAML.
  * Rename ``Map`` to ``TextMap``.
  * Add type synonyms. Note that type synonyms are not serializable.
  * Add package metadata, i.e., package names and versions.

  Note that the default output of ``damlc`` is stil DAML-LF 1.7. You
  can produce DAML-LF 1.8 by passing ``--target=1.8``.

changelog_end

* Update encoder

* Update java codegen tests

* Update comment in scala codegen

* Handle TSynApp in interface reader

* Bump lf_stable_version to 1.7

* Fix kvutils tests
2020-03-02 18:29:26 +01:00
Moritz Kiefer
c68dd19ade
Decode and validate package metadata in Scala (#4653)
This adds the code for decoding and validating package metadata
that is now emitted by damlc.

changelog_begin
changelog_end
2020-02-21 18:20:42 +00:00
Remy
f73894dc25
Engine: drop useless EContractId Ast node (#4236)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-28 10:41:30 +01:00
nickchapman-da
706464d1a6
More DAML LF type synonym validation tests (#4181)
* more type synonym validation tests, including negative tests
* check type synonym definitions are well formed

changelog_begin
changelog_end
2020-01-24 11:06:05 +00:00
nickchapman-da
62d592ec62
support type synonyms in scala (#4101)
* Support DAML-LF type synonyms in scala.

CHANGELOG_BEGIN
CHANGELOG_END

* dont create synonymns in GenerateSimpleDalf

* extend DAML-LF parser to support type synonyms

* test: expand type synonyms correctly
2020-01-23 10:49:28 +00:00
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
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
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
Remy
5e63db7a40 speedy: Rename SMap to STextMap (#3664)
+ rename MAP to TEXTMAP in decoder/encoder
2019-11-28 17:05:26 +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
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
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
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
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
Andreas Herrmann
2bd1db490a
Replace bazel-deps by rules_jvm_external (#3253)
* Update bazel-common to fix javadoc issues

Specifically, to fix the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel:7:1: in javadoc_library rule //ledger-api/rs-grpc-bridge:rs-grpc-bridge_javadoc:
Traceback (most recent call last):
        File "/home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel", line 7
                javadoc_library(name = 'rs-grpc-bridge_javadoc')
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/com_github_google_bazel_common/tools/javadoc/javadoc.bzl", line 27, in _javadoc_library
                dep.java.transitive_deps
object of type 'JavaSkylarkApiProvider' has no field 'transitive_deps'
```

* Define Maven deps using rules_jvm_external

* Pin artifacts

* Remove bazel-deps generated targets

* Remove bazel-deps

* Switch to rules_jvm_external targets

* update bazel documentation

* pom_file: There are no more bazel-deps targets

* BAZEL-JVM.md `maven_install` typo
2019-10-28 13:53:14 +01:00
Remy
f3b98ca31d DAML LF: limit allocations for trivial constants (#3212)
* speedy: limit allocation of trivial SValue constants

* daml-lf: limit allocation of constants for Value, Exp, Type

* weaken numeric equality in ledger service test
2019-10-18 15:00:49 +00:00
Moritz Kiefer
dcdcf7f0c0
Generalize AnyTemplate type to Any in DAML-LF (#3141)
* Generalize AnyTemplate type to Any in DAML-LF

See #3131 for the motivation for this. The tl;dr is that we need
something like AnyTemplate for choice types as well.

Since the protobuf was already more general in anticipation of such a
change, this change only changes the internal AST on the Haskell and
Scala side.

Since AnyTemplate change has never made it out of 1.dev, I updated the
changelog in the LF spec instead of adding a new entry.

* Update daml-lf/spec/daml-lf-1.rst

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* windows debugging

* more windows debugging

* clean expunge

* don’t cat the config file

* remove comment on type equality

* windows …

* gnah

* foobar

* foobar

* does anything ever work?

* reenable caching

* Do not build daml-lf-ast separately
2019-10-10 08:51:52 +02:00