Commit Graph

452 Commits

Author SHA1 Message Date
Neil Mitchell
fc159a2d41 Fix hie.yaml so you can still load hie-core in hie-core (#2786) 2019-09-06 06:43:31 +02:00
Anup Kalburgi
0a9e0a8911 Adding fields to template graphs (#2673)
* Adding more info to dor

* Adding fields to the graph

* Spelling mistakes and params

* Removing single line function

* Moving the duplicated code

* Revert "Moving the duplicated code"

This reverts commit 520b5d9b0d.

* Adding more structure to graph

* Working tests with graph which is more easy to understand and change.
have few more tests to migrate

* Adding edge details

* One more to go

* Adding more verbose field information

* All tests now tests the fields that are being added

* Removing unused Import

* defined not refined

* Unused imports

* Names need to be consitent

* Acutal and Expected, not expected and expected

* Removing unused export

* Lints
2019-09-05 15:57:58 +00:00
Bernhard Elsner
ad77aba246 Fix symbol in DA.Logic (#2765) 2019-09-05 12:17:28 +00:00
associahedron
ce52a0a24f
Escape all text in rst docs. (#2747)
* Escape text in rst.

* Fix the escaping

* Fix spacing and tests
2019-09-05 12:39:29 +01:00
Martin Huschenbett
b7bcba4ca7
Drop deprecated TextMap.filter from daml-stdlib (#2761)
It has been deprecated for a while now with a hint to use `filterWithKey`
instead. We should add
```haskell
filter : (v -> Bool) -> TextMap v -> TextMap v
```
after the next SDK release instead. This is tracked in #2760.
2019-09-05 13:34:49 +02:00
Martin Huschenbett
b95daba9ed Simplify conversion of top level bindings to DAML-LF (#2730)
At the top level we don't care if bindings are recursive or not. The logic
that takes care of this ignorance is currently mixed with the actual logic
for converting the bindings.

This PR separates these concerns properly. This is also in preparation for
another upcoming change which needs access to all top level bindings.
2019-09-02 19:51:03 +00:00
Martin Huschenbett
f787a0d715 Remove unused tracking of default methods from conversion to DAML-LF (#2729)
The removed code had a purpose in the past but has not been used anymore for
a while. Let's remove it.
2019-09-02 18:49:48 +00:00
Rohan Jacob-Rao
30fe23a4c1 Organise generic templates and instances into separate files (#2727)
* Organise generic templates and instances into separate files, add Fungibility

* Expect hlint warning in scenario
2019-09-02 18:39:45 +00:00
associahedron
ea9d9cb02e Convert Decimal type, literals, and primitives to Numeric when feature is available. (#2723)
* Add missing alpha-equivalence case.

* Type-level nat is not serializable.

* Convert decimal primitives as numeric primitives if feature is available.

* Convert decimal literals to numeric if available.

* Better approach to decimal primitves.

* Fixing BEDecimalFromText

* Add issue number

* Set Numeric feature at v1.7
2019-09-02 17:10:26 +00:00
Moritz Kiefer
336cad1016
Fix ghc-pkg runfiles (#2726)
This allows us to run "damlc build" in Bazel rules which is a
prerequisite for doing anything with DAML packages as they don’t work
with "damlc package".
2019-09-02 18:50:25 +02:00
Martin Huschenbett
222f8c6fc1
Revert type based computation of table headers in scenario view (#2704)
The type based computation doesn't work as intended. Let's go back to the
value based computation for now and fix it later.
2019-09-02 12:35:52 +02:00
Robin Krom
d5c6d93772
langauge: suppress warnings for unrecognised pragams in upgrades (#2711)
This make the build of upgrade modules a bit more quiet. The warnings
appear because in the generated generic instances there is an
unrecognised {-# NO_OVERLAPP #-} pragma annotation.
2019-08-30 12:21:01 +02:00
associahedron
0eed4afb3f Add Numeric literals in daml-lf-ast and daml-lf-proto. (#2706)
* Add Numeric literals.

* Decode numeric literals

* Add tests and fix Read for s=0

* lint

* Copyright header

* Use numericMaxScale in Serializability check

* Fix comment!
2019-08-30 08:45:03 +00:00
Remy
20649cf78e ledger-api: rename decimal field to numeric in value Proto (#2688)
* add Numeric.java

* ledger-api: rename `decimal` field to `numeric` in value protobuf

* Address Gerolf's comment

* ledger-api: add missing renammings

* ledger-api: relax syntax of numbers that can be sent as numerics

* extractor:  fix

* leger-api: change format of number though ledger api

* daml-lf: fix numeric regexp

* ledger: fix tests
2019-08-29 22:51:33 +00:00
Rohan Jacob-Rao
8dbc556655 Sketch of generic transfers and swaps (#2640)
* Templates and scenario for generic transfers

* Simplify transfer workflow by self-issuing cash

* Generic swap in the same style as Transferrable

* Use Template class constraints instead of *Instance constraints

* Shorter asset name for transferrable/swappable templates

* Shorten some stuff

* Simplify swap acceptance, remove dependency on transfers, add some checks in scenarios

* Remove FlexibleContexts extension which should be on by default

* Move Asset typeclass and Cash instance to separate module

* Rename Swap module to Swappable

* Revert change to VERSION file
2019-08-29 16:05:24 +00:00
Robin Krom
7fca591df0
replace main file with a pointer to the source root (#2687)
* language: compile everything in the source directory

This removes the need to specify a 'main'. Instead we 'source' in
daml.yaml should point to the source root directory.
2019-08-29 13:42:33 +02:00
Moritz Kiefer
3cda28935b Refactor DAR manifest reader (#2699)
* Refactor DAR manifest reader

This PR replaces the ad hoc string munging by a proper parser.

* Fix tests

* Fix more tests

* Factor out isHeaderChar
2019-08-29 10:26:53 +00:00
Moritz Kiefer
abfce20ce9
Fix damlc manifest writer (#2689)
Previously, we didn’t broke at 72 chars instead of 72 bytes and we did
not take the newline character into account.
2019-08-28 16:31:20 +02:00
Moritz Kiefer
664a633e20
Fix heap corruption in grpc-haskell-core (#2685)
The details are in the patch which I will also upstream.

fixes #2644
2019-08-28 16:21:37 +02:00
Martin Huschenbett
596058ac3f Allow boundedly polymorphic recursive functions without type annotation (#2684)
Currently, recursive top level functions whose type is boundedly polymorphic
require a type annotation to make it through the conversion to DAML-LF.

This PR changes the conversion slightly such that a type annotation is n o
longer required.

This fixes #2669.
2019-08-28 12:56:06 +00:00
associahedron
dce578bbea damlc: Add Numeric primitives and type-level nats. (#2670)
* Add Numeric primitives and type-level nats

* Statically enforce Numeric scale in serializability check
2019-08-28 12:30:33 +00:00
Martin Huschenbett
25d1e2ce63
Fix the safety of the empty map in the DAML-LF simplifier (#2679)
Currently, we use `Safe 1` as the safety of the `BEMapEmpty` primitive. This
is clearly wrong since `BEMapEmtpy` is not supposed to be applied to a value
(but only to a type). Thus, it must be `Safe 0`. This has not caused any
problems in the past because the type checker would have caught any
application of `BEMapEmpty` to a value.
2019-08-28 13:20:31 +02:00
Moritz Kiefer
52101479d4
Shutdown IdeState in withDamlIdeState (#2680)
Noticed this while trying to debug the segfaults.

I don’t have a concrete case where this causes issues (usually we only
call this once on startup so leaks are not an issue) but we might as
well do it properly.
2019-08-28 13:02:39 +02:00
Martin Huschenbett
016b73b3de Enable MonoLocalBinds and FlexibleContexts by default in DAML (#2678)
Both language extension are needed to improve the UX of generic templates.
Without them templates a la
```
template Template (A t) => B t with
```
would produce an error that we need `FlexibleContexts` for the
`Template (A t)` context and a warning suggesting to simplify it to
`AInstance t`. The latter would expose an implementation detail we prefer
to hide.
2019-08-28 10:21:54 +00:00
Shayne Fletcher
8bcf6bf568
Smoke tests for newly added dlint hints (#2672) 2019-08-27 15:09:52 -04:00
Anup Kalburgi
ff77b2e285 Correcting spelling mistakes (#2671) 2019-08-27 18:35:08 +00:00
associahedron
bd686aa6a0 damldocs: Rewrite class method extraction and fix handling of default methods. (#2667)
* Add test case for default method signature

* Fix default method docs

* lint

* Refactor ty calculation in getMethodDocs

* Add test for multiple names in one method type sig
2019-08-27 12:50:14 +00:00
Anup Kalburgi
09b766c502 Visual integration with LSP (#2597)
* daml visualize with lsp

* Working command execution with ide

* Have to call visual now

* Split function

* Wrong constuctions of world or the module

* Working almost

* Have to gather all modules

* Now works end to end. Considers all the daml files in workspace

* removing unused code

* removing unused dependency

* Removing unused JS code and better error message

* Function re-arrange

* Removing us of heaad, instead handling error

* Format and rearranging

* Removing unused assignment

* Formating everything

* missed dependency

* Generating visual only for the file that is open

* Using modules from generated pkg, error messages

* Bringing back the commands

* Names and formating

* consitent error message

* Removing Just pattern match using _use now

* package

* Moving visual to a different module

* Function simple

* Removing Rule as it increases memeory consumption

* TODO LSP error

* White space

* Fmt things

* Handling if command was executed for a non daml files

* Better error message

* debugging

* Fix executeCommand

* Adding tests to execute command. Thanks moritz

* Unwanted lines

* Spaces and comment

* 3rd time ?

* Spaces are white

* assert equal instead of assert bool
2019-08-26 15:47:29 +00:00
Robin Krom
c1e7f0ad61
language: use generic templates for upgrades (#2605)
* language: use generic templates for upgrades

Instead of generating templates we now have generic upgrade/rollback
templates in the standart library and we just create instances of in the
migration project. I will update the documentation in a follow up PR.
2019-08-26 15:30:47 +02:00
Remy
6a96060af1 daml-lf: udpate LF protobuf for numerics (#2649)
* daml-lf: update proto for Numerics

* daml-lf: test decoder

* daml-lf: update spec

* daml-lf: polish proto doc

* damlc: address reviewers' comments

* daml-lf: minor fix
2019-08-26 11:55:48 +00:00
Moritz Kiefer
67c2e2a9ef
Switch to upstream gRPC-haskell (#2642)
* Switch to upstream gRPC-haskell
2019-08-23 15:10:15 +02:00
Moritz Kiefer
0419e31f0c Mark doctest integration tests as flaky (#2645)
They fail a bit too often to not mark them flaky. I’ve opened
https://github.com/digital-asset/daml/issues/2644 to track this.
2019-08-23 07:57:10 +00:00
Remy
997212c8f4
daml-lf: decommission internal Decimal type in favor of Numeric. (#2594)
* daml-lf: ValueDecimal -> ValueNumeric
* Apply suggestions from Stephen's code review
   Co-Authored-By: Stephen Compall <stephen.compall@daml.com>
* extractor: add comment about Numeric SQL format
2019-08-22 18:07:47 +02:00
associahedron
271795a6d0 damldocs: Only strip implied typeclass member constraint, not all constraints. (#2632)
* Add test case for canstrained class method.

* Fix constrained class methods bug.

* dubious lint
2019-08-22 14:44:17 +00:00
Moritz Kiefer
9654af6a26
Output more information on failure in the doctest integration tests (#2634) 2019-08-22 16:38:54 +02:00
Moritz Kiefer
88c2a1fd15 Add stripInfix to daml stdlib (#2629)
fixes #2617
2019-08-22 13:21:03 +00:00
Moritz Kiefer
03468a72ea Fix VSCode extension if extraArguments is empty (#2625)
Apparently somebody thought that splitting an empty string should
return a singleton array …
2019-08-22 08:16:59 +00:00
Moritz Kiefer
2a9eee8fae Add an extraArguments config in the VSCode extension (#2620)
This allows passing extra arguments like `--ghc-option -W`.
2019-08-21 18:50:27 +00:00
Moritz Kiefer
82ad89e770 Support --ghc-option in damlc ide (#2619)
fixes #2612
2019-08-21 13:56:15 +00:00
associahedron
e367f000a7 Hide GHC.Base.(++) (#2616) 2019-08-21 11:29:38 +00:00
associahedron
f14a925a91 damldocs: External docs links. (#2589)
* Allow for external anchor locations.

* Extracting package names in types.

* Create external references to stdlib.

* Update golden tests.

* Refactor DA.Daml.Doc.Render.Monoid
2019-08-21 10:15:42 +00:00
Rohan Jacob-Rao
4c53841eeb
Upgrade ghc-lib, improving parsing of template headers (#2609)
* Update ghc-libs
* Test for parsing template headers
2019-08-20 13:24:15 -04:00
Moritz Kiefer
0e777d9fc8 Delete obsolete proto3-suite patch (#2601)
* Delete obsolete proto3-suite patch

My patch has been upstreamed so no need to keep it around in our repo.

* Upgrade proto3-wire

* Adapt to changes in proto3-suite
2019-08-20 10:17:26 +00:00
Robin Krom
2374b8c231
Migrate same package name (#2564)
* language: smoothing out the migration experience

Some improvements to make the migration process simpler when migrating
between packages with the same name, e.g. foo-1.0.0 -> foo-2.0.0. This
is the main use case.
2019-08-20 11:02:41 +02:00
Remy
2abf27cd67 Revert DAML-LF proto change for Numeric (#2600)
* Revert DAML-LF proto change for Numeric

This partially reverts commit 0ffe5945b8.

* daml-lf: udpate release notes

* Apply suggestions from code review

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-08-20 08:13:15 +00:00
Martin Huschenbett
f11e09f60f Stop highlighting signature as a keyword in the IDE (#2599)
This fixes #2598.
2019-08-20 07:23:39 +00:00
Moritz Kiefer
3e2ccc0842
Switch to a streaming zip encoding (#2595)
This switches the creation of the archive in `daml build` from
`zip-archive` to `zip`. This has a few advantages:

1. It gets rid of lazy IO for reading all the interface and source
files. This avoids the high usage of file handles in `daml build`.

2. It seems to be a slight improvement in max memory usage and runtime
and a giant improvement in allocations (but I think the latter
probably comes primarily from the fact that the locations are moved to
the bzip C library). The improvement in max memory usage is less than
I expected so probably there is still something off somewhere.

For now, I only switched over `createArchive`. Archive reading is
still done using `zip-archive`. We might want to switch that over in a
separate PR.
2019-08-19 20:15:13 +02:00
Bernhard Elsner
d9298c8744 Various improvements to make hs-bindings usable outside repo (#2583) 2019-08-19 16:44:45 +00:00
Robin Krom
4634d35df2
language: Check for different SDK versions when building pkg db (#2591)
* language: Check for different SDK versions when building pkg db

This fixes #2510. We check whether packages were compiled with differen
SDK versions and emmit an understandable error if so.

* addressing moritz comments
2019-08-19 18:43:18 +02:00
Moritz Kiefer
b4dc886fa8
Bump stackage (#2588)
* Bump stackage

This PR switches us over to the latest Stackage LTS 0.14.1 (we were on
0.13.x before, so this includes major bumps) and gets rid of some
obsolete overwrites.
2019-08-19 13:31:10 +02:00