Commit Graph

1499 Commits

Author SHA1 Message Date
Moritz Kiefer
b7daa5f7d8
Address remaining dependabot alerts (#11045)
* Address remaining dependabot alerts

changelog_begin
changelog_end

* downgrade string-width

5.0.0 is too new for our setup

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-09-28 11:12:14 +02:00
Moisés Ackerman
03203b7360
Define encoding/decoding for module imports (#11036)
* Define encoding/decoding for module imports

First step towards closing #10773

changelog_begin
changelog_end

* Update compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion/MetadataEncoding.hs

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-09-28 08:48:48 +00:00
Sofia Faro
0d3ae6e14c
interface methods: Haskell Typechecker (#11028)
part of #11006

changelog_begin
changelog_end
2021-09-27 12:32:05 +01:00
Sofia Faro
4075624cfc
interface methods: Haskell AST (#11018)
* interface methods: Haskell AST for methods

Part of #11006. This leaves typechecker and LF conversion for later, on
the haskell side.

changelog_begin
changelog_end

* Forgot ECallInterface in DecodeV1

* fix a test
2021-09-27 10:10:21 +01:00
Sofia Faro
bf8b75dab5
interface methods: Add protobuf definitions. (#11005)
* interface methods: Add protobuf

Adds protobuf definitions for interface methods and calling them.
Encoders/decoders just ignore the extra stuff or error out.

Part of #10810 (maybe)

changelog_begin
changelog_end

* Update issue numbers where appropriate

* update stable protos
2021-09-23 14:55:19 +01:00
Moisés Ackerman
35666caae8
Add MINIMAL pragma for Additive type class (#11001)
* Add MINIMAL pragma for Additive type class

This ensures that the compiler gives an error if both (-) and negate are missing in an instance

Fixes #11000

changelog_begin
changelog_end

* Add test case to ensure incomplete Additive instance declaration triggers error message
2021-09-23 11:01:53 +00:00
Remy
58c82b6e41
LF: reduce usage of NodeCreate.coinst (#10988)
Access directly templateId, argument, and agreementText.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-22 18:52:23 +00:00
Sofia Faro
3f4dbf6f8e
interfaces: Syntax highlighting for interfaces (#10987)
* interfaces: Syntax highlighting for 'interface'

To make daml studio look pretty.

changelog_begin
changelog_end

* Add 'implements' as well
2021-09-22 16:40:14 +00:00
Sofia Faro
d52a2857da
interface: Add test for conversion functions (#10991)
Test conversions of both payloads and contract ids

changelog_begin
changelog_end
2021-09-22 16:39:58 +00:00
Sofia Faro
34390f7062
interfaces: Implemented conversions, added test. (#10982)
Part of #10810

- Implemented ToInterface, FromInterface in speedy
- Added a test that exercises and fetches an interface
- Fixed a bug in SBUChoiceInterface

Hey, interfaces work now!

changelog_begin
changelog_end
2021-09-22 15:50:54 +01:00
Moritz Kiefer
99836d2610
Handle fetchByKey callback correctly in scenario runner (#10980)
fixes #10977

Turns out assertions are good unless they’re wrong …

This only affects scenarios, the engine never looks at the callback.

changelog_begin
changelog_end
2021-09-22 13:19:57 +02:00
Moritz Kiefer
4acf34b5fc
Add conversions from/to interfaces in Daml parser (#10954)
* Add conversions from/to interfaces in Daml parser

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-09-21 18:24:12 +00:00
Sofia Faro
cebe6ed482
Refactor safetyStep in the simplifier. (#10948)
changelog_begin
changelog_end
2021-09-21 15:49:48 +01:00
Sofia Faro
ac192fc6db
interfaces: Add to/from interface in Haskell typechecker (#10951)
* interfaces: Add to/from interface in hs typecheck

changelog_begin
changelog_end

* questionable lint
2021-09-21 15:29:33 +01:00
Sofia Faro
724e50d739
interfaces: Add to/from interface in Haskell AST (#10945)
Part of #10810

changelog_begin
changelog_end
2021-09-21 10:24:10 +01:00
Robin Krom
2edfc062a0
ifaces: name collision, typecheck fetch/exercise (#10896)
* ifaces: name collision, typecheck fetch/exercise

This adds name collision detection and adds typechecking for
fetch/exercising of interface instances.

CHANGELOG_BEGIN
CHANGELOG_END

* turn on exercises in InterfaceDesugared test case

* Update compiler/daml-lf-tools/src/DA/Daml/LF/TypeChecker/NameCollision.hs

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-09-20 21:40:26 +00:00
Remy
5dc15c6911
LF: rename language Interface to PackageInterface (#10938)
To avoid confusion with the new Daml concept of Interface.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-20 19:04:14 +00:00
Sofia Faro
409c0b4f60
interfaces: Add to/from_interface in proto (#10937)
* interfaces: Add to/from_interface in proto

Part of #10810

changelog_begin
changelog_end

* fix typo
2021-09-20 13:44:00 +00:00
Robin Krom
50291ed61b
interfaces: scala typechecker implementation (#10867)
* interfaces: scala typechecker implementation

This is the scala side of the lf typechecker for interfaces.

CHANGELOG_BEGIN
CHANGELOG_END

* added collision check

* added exercise/fetch typechecking

* review suggestions

* added todos for collision/typing scala tests
2021-09-16 20:37:33 +00:00
Moritz Kiefer
cac8391d4c
Bump ghc-lib to include daml interfaces parser (#10747)
changelog_begin
changelog_end
2021-09-16 17:52:16 +00:00
Moritz Kiefer
9b0fa29aec
Separate exercise & fetch for interfaces from templates (#10908)
* Separate exercise & fetch for interfaces from templates

part of #10810

changelog_begin
changelog_end

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

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

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

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>

Co-authored-by: Sofia Faro <sofia.faro@digitalasset.com>
2021-09-16 12:05:11 +00:00
Moritz Kiefer
8e22bb6b2d
Drop ContractId typeparameter from Value (#10827)
99% of our usecases use Value[ContractId] so this PR just fixes it.

The few other usescases are:

1. Value[Nothing] which we use for keys. This is technically more
precise but we benefit very little from it.
2. Value[String] mostly because in a few places we are lazy.

We don’t have any code which benefits from being polymorphic in the
contract id type.

changelog_begin
changelog_end
2021-09-16 08:46:57 +00:00
Moritz Kiefer
f08ac5f65c
Desugar interface implements declarations (#10895)
* Desugar interface implements declarations

This PR adds desugaring for tplImplements. This consists of the
corresponding typeclass instance (which we just ignore in LF for now,
we probably need it once we have pure functions) and a _implements_
top-level value.

changelog_begin
changelog_end

* Address review feedback

changelog_begin
changelog_end
2021-09-15 19:48:59 +00:00
pbatko-da
6dcdaa411c
[DPP-589] Add CLI flag to select minimum enabled TLS version (#10854)
- Add support for specifying either 1.2 or 1.3 as minimum TLS versions for ledger api server.
- Log enabled protocols (~TLS versions) and cipher suites at server and client startup.
- Add integration tests against Sandbox-classic and Sandbox

CHANGELOG_BEGIN
Sandbox: Add CLI flag to select minimum enabled TLS version for ledger API server.
CHANGELOG_END
2021-09-14 12:37:38 +02:00
Robin Krom
8f5b4fa84c
interfaces: protobuf encoder haskell side (#10850)
* interfaces: protobuf encoder haskell side

This is the implementation of the protobuf encoder on the haskell side.

CHANGELOG_BEGIN
CHANGELOG_END

* missing decoder cases for added interface data constructor
2021-09-13 14:36:14 +00:00
Moritz Kiefer
9a4c9df06a
Implement LF desugaring of interface definitions (#10834)
This only handles the interface definition, not the implementation in
the template. There are also a few rough edges:

1. It maks all choices as consuming.
2. it ignores locations

But for a poc that doesn’t seem too bad.

The tests don’t do anything super useful since the typechecker falls
over but I checked tha tthe generated LF looks more or less reasonable.

changelog_begin
changelog_end
2021-09-13 15:15:31 +02:00
Robin Krom
2aaf601912
interfaces: protobuf decoder haskell side (#10849)
CHANGELOG_BEGIN
CHANGELOG_END
2021-09-13 14:58:48 +02:00
Robin Krom
6dc769b7ad
interfaces: lf typechecker implementation (#10843)
* interfaces: lf typechecker implementation

CHANGELOG_BEGIN
CHANGELOG_END

* review suggestions
2021-09-13 14:58:33 +02:00
Moritz Kiefer
6d347d4e88
Add daml interfaces to the Haskell LF AST (#10811)
* Add daml interfaces to the Haskell LF AST

Just copied from Sofia’s PR with no changes and stubbed all usages of
it that aren’t trivial.

changelog_begin
changelog_end
2021-09-08 15:48:02 +00:00
Moritz Kiefer
8830eaa2ec
Drop controller can syntax from compiler tests (#10807)
You definitely want to review this with whitespace disabled.

changelog_begin
changelog_end
2021-09-08 15:28:09 +02:00
Robin Krom
b8bd5e6399
interface PoC: protobuf definitions (#10796)
* interface PoC: protobuf definitions

The protobuf changes for the Daml interface PoC.

CHANGELOG_BEGIN
CHANGELOG_END

* dummy interface decoder/encoder
2021-09-07 16:58:49 +02:00
Remy
c4e0a755d4
LF: drop ad-hoc ImmArray builders (#10763)
Since we switch to scala 2.13, ImmArray companion object extends
`Factory`. Hence:

- the `apply` methods of `ImmArray` override the one from `Factory`

- we can use the notation `.to(ImmArray)` to convert an `Iterable` to
  `ImmArray`

This PR drops those `apply` ImmArray. Conversion from Iterable to
`ImmArray` should use the `.to(ImmArray)`.

CHANGELOG_BEGIN
CHANGELOG_END
2021-09-04 16:10:07 +02:00
Moritz Kiefer
e9c8af5024
Bump ghc-lib to include dropped parsing code for generic templates (#10735)
* Bump ghc-lib to include dropped parsing code for generic templates

changelog_begin
changelog_end

* bump snapshot

changelog_begin
changelog_end

* drop old generics file

changelog_begin
changelog_end

* drop other broken file

changelog_begin
changelog_end

* Bump again

changelog_begin
changelog_end

* bump to merged commit

changelog_begin
changelog_end

* and bump snapshots

changelog_begin
changelog_end
2021-09-01 15:35:40 +02:00
Remy
9ef3377864
LF: Update specification with Contract ID Comparability check (#10703)
This is part of #10504.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-31 13:01:25 +02:00
Moritz Kiefer
6016633bb7
Construct ParsedModule directly in Daml Repl (#10701)
This is a relatively large change unfortunately which unfortunately
requires reimplementing parts of the logic of the typechecker & core
compilation. I don’t think it is too bad but we might want to think
over time if we can factor this better.

This fixes #10073 and fixes #10664 by referencing the exact types
instead of going via the renamer.

There are some minor changes around error messages for "module not
found" errors. This is because these are now caught in the
typechecker instead of in our own code. We could keep the errors but
it requires duplicating even more logic and I don’t really see what it
buys us so I think I prefer the approach here.

changelog_begin

- [Daml Repl] Fix a bug where bindings with out of scope types would result in error in following lines.

changelog_end
2021-08-30 17:28:16 +02:00
Andreas Herrmann
0b7980d6eb
Update rules_haskell (#10674)
* update rules_haskell

changelog_begin
changelog_end

* Build proto3-suite lib and exe in same repo

changelog_begin
changelog_end

* drop unneeded stack_snapshot packages

* Use packages.bzl consistently

* Sort stack_snapshot attribute values

* Remove unused constant

* drop unneeded stack_snapshot packages in compat

changelog_begin
changelog_end

* Sort stack_snapshot attribute values in compat

* Remove redundant dicts.add in compat

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2021-08-26 10:41:58 +02:00
Leonid Rozenberg
adbe65fae1
Document ActionFail vs CanAbort (#10657)
CHANGELOG_BEGIN
CHANGELOG_END
2021-08-25 20:51:29 +02:00
Moritz Kiefer
fc9d35935a
Drop alternative rules from dlint config (#10646)
We don’t have Alternative in daml-stdlib so these don’t make any sense.

changelog_begin
changelog_end
2021-08-25 12:52:51 +02:00
nickchapman-da
387c68b9eb
Normalize transaction values within the engine (#10648)
Create normalized TXs when a partial TX is finalised.

Except in limited cases! (i.e for scenario-runner, sandbox)

CHANGELOG_BEGIN
CHANGELOG_END

normalize values in the engine as they are converted from speedy-values

fix 2.12 build

backout redundant change

ensure byKey field is correctly normalized when constructed by engine

rename flag: valueNormalization -> transactionNormalization

improve comment

delete commented-out code

rename: toValueNorm --> toNormalizedValue

rename: (SValue.) toValue --> toUnNormalizedValue

revert changes to ptx so that the interface to insertCreate() etc is Value-based (not SValue-based)

improve comments

respell: toUnNormalizedValue --> toUnnormalizedValue

fix build
2021-08-25 09:53:26 +01:00
Moritz Kiefer
055be4b3cb
Disable deprecation warnings for data-dependencies (#10647)
Makes no sense to warn about this at this point since you cannot do
anything about this once that fails.

changelog_begin
changelog_end
2021-08-23 16:39:57 +02:00
fabiotudone-da
4a9331ca55
Upgrade Nixpkgs [KVL-1045] (#10624)
* Update the channels link in Upgrading.md

* Update the nixpkgs-unstable commit

CHANGELOG_BEGIN
CHANGELOG_END

* Fix new `hlint` warnings.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2021-08-20 12:34:19 +00:00
Robin Krom
0c1878530b
test: test for platform independent dars (#10535)
We add a CI test to check that dars don't depend on the underlying
operating system where the dar is build.

CHANGELOG_BEGIN
CHANGELOG_END
2021-08-17 18:59:12 +02:00
Sofia Faro
fb09b72f96
Improve divulgence warning message. (#10595)
Based on feedback from @bame-da on issue #9947

changelog_begin
changelog_end
2021-08-17 13:06:03 +01:00
hgrano
4430f52cdc
changelog_begin (#10579)
- [Daml Stdlib] Ord instance added for NonEmpty
changelog_end
2021-08-15 12:52:03 +02:00
Moritz Kiefer
c447898cc9
Fix display of unhandled exceptions in the scenario service (#10572)
fixes #10570

I’m increasingly convniced, that the future failures here are a
maintenance nightmare and we should switch to Either completely but
not in this PR

changelog_begin
changelog_end
2021-08-12 14:35:26 +02:00
Gary Verhaegen
9756bf8104
add minimumOn & maximumOn (#10527)
Requested in #10509. Should we also add `minimumBy` and `maximumBy` for
consistency with `sortBy`?

CHANGELOG_BEGIN
- The DA.List and DA.List.Total modules now export minimumBy, maximumBy,
  minimumOn and maximumOn, respectively behaving similarly to sortBy and
  sortOn.
CHANGELOG_END
2021-08-11 16:34:38 +00:00
Robin Krom
1affbd23d2
feature: persist script view config in worspace (#10521)
* feature: persist script view config in worspace

This fixes #9188. We remember the config for the script view in the
workspace state. This way script results can be closed and reopened with
the same view config. This also works across restarts of Daml studio.

CHANGELOG_BEGIN
[Daml studio] The script view configuration is remembered for each
script in a workspace and does not need to be reconfigured upon
closing/reopening or restarting of Daml studio.
CHANGELOG_END

* removal of unused imports
2021-08-09 18:24:14 +02:00
Moritz Kiefer
348c6de92c
Add dlint rule to suggest === (#10485)
* Add dlint rule to suggest ===

This rule doesn’t quite work in all cases since you can have types
that have Eq instances but not Show instances. However, I think the
benefits of people learning about this are much larger than the
downsides here of getting a hint that doesn’t apply in edge cases.

changelog_begin
changelog_end

* fix all the tests, why are there so many :(

changelog_begin
changelog_end
2021-08-05 09:44:57 +00:00
Robin Krom
36f3ba8a6a
lsp-types patch for platform independence (#10288)
* fix shake rebuild tests

* patch pretty printing in ghc

* pin linux deps

* pin windows deps

* cosmetics

* address review

* update ghc commit hash

* pin linux stackage deps

* update stack snapshot

* pin windows deps
2021-08-04 21:33:52 +02:00
Robin Krom
e5514bc863
feature: remember checkboxes in script view (#10469)
* feature: remember checkboxes in script view

Fixes #9177. This makes the script view remember the choices for
'show_archive', 'show detailed disclosure' and 'table/transaction' view
accross changes to the script.

CHANGELOG_BEGIN
[daml studio] The script view now remembers checkboxes for detailed
disclosure view and archived contracts across script changes.
CHANGELOG_END

* factor out hide/show class code

* more factoring
2021-08-04 16:12:39 +02:00