Commit Graph

109 Commits

Author SHA1 Message Date
Moritz Kiefer
1f8c273263
Move diagnostic tests from language-server-tests to new lsp-tests (#1554) 2019-06-07 15:34:42 +02:00
Martin Huschenbett
504337b5b2
Expose conversion between text and code points in daml-stdlib (#1536)
* Expose conversion between text and code points in daml-stdlib

* Fix tests

* Fix feature dependency

* Fix test imports
2019-06-06 11:33:07 -04:00
Moritz Kiefer
1f76f23022 Run daml-ghc tests with full validation in the scenario service (#1546)
* Run daml-ghc tests with full validation in the scenario service

Fixes #128

* Swap default of optScenarioValidation
2019-06-06 13:14:11 +00:00
Moritz Kiefer
217c56d072
Add an option to the IDE to disable the scenario service (#1522)
* Add an option to the IDE to disable the scenario service

This is useful for several reasons:

1. We currently have to disable all tests using the scenario service
on Windows since they are extremely flaky due to issues we haven’t
been able to solve so far. This allows us to run at least a subset of
tests on CI.

2. The LSP tests currently start a new instance of damlc for each
test (we might want to revisit this but it seems to be sufficiently
fast so far) and not starting the scenario service allows us to speed
things up a bit.

3. On large projects, this could be useful to avoid having the IDE use
up even more memory and speed things up a bit. However, this PR does
not yet expose this in a convenient way so there is more work to be
done (in separate PRs) to make that a viable option.

* Fix LSP tests on Windows
2019-06-06 12:06:07 +02:00
Martin Huschenbett
b72f560bbf
Add Pretty instances for everything in the DAML-LF AST (#1532)
This was scary to do when we still had all the `Tagged` stuff around. Since
that stuff is gone, let's add the instances and make pretty print anything
DAML-LF related more uniform.
2019-06-05 13:59:05 -04:00
Martin Huschenbett
468ef3e469
Make it explicit that contract key maintainers are computed from key (#1527)
* Use ghc-lib-0.20190604

* HieFile fix

* Update to ghc-lib-0.20190604.1

* Make maintainers depend directly on key

* Remove useless tests

* Adjust documentation

* Add release notes

* Simplify some code

* Fix tests to use new syntax

* Fix template desugaring docs

* Fix more tests
2019-06-05 10:27:38 -04:00
Remy
bf5309b42e daml-lf: add enum pattern matching (#1506)
* daml-lf: add enum pattern matching

* daml-lf: add test for interpreter pattern matching
2019-06-04 22:25:22 +00:00
Moritz Kiefer
9689f00e58
Initial boilerplate for an LSP-based test suite (#1516)
This needs more work but I’d like to get the initial boilerplate in
first. We will also have to make some changes to lsp-test and expand
it in various ways but those should hopefully be upstreamable.
2019-06-04 20:48:18 +02:00
Moritz Kiefer
e400bc7eb8
Remove use of managed for starting the scenario service (#1508)
Ironically `managed` didn't turn out to make our code more manageable
and we ended up mostly using it in very isolated places only to then
immediately convert it back to bracket-style functions using `with`.

This PR also removes the use of `managed` from the GcpLogger which was
the only other place where we are using it and it finally kills the
rather silly logic that starting up the scenario service was tied to
having an event logger.
2019-06-04 17:17:05 +02:00
Remy
0d25b73d1f daml-lf add builtin to (un)pack string in code points (#1480)
, namely

* FROM_TEXT_CODE_POINTS: Text -> [Int64]
* TO_TEXT_CODE_POINTS: [Int64] -> Text
2019-06-04 14:06:25 +00:00
Moritz Kiefer
5cb36eeddb
Escape colons in URIs to be consistent with VSCode (#1504)
The details are described in a comment but the short story is
that a roundtrip Uri -> FilePath -> Uri necessarily loses information
on which characters were escaped. The long-term solution here is to
avoid this roundtrip altogether but this at least fixes the issue for
now.
2019-06-04 09:45:29 +02:00
Martin Huschenbett
5396f42b3a
Drop support for DAML-LF 1.3 from damlc (#1445)
* Drop support for DAML-LF 1.3 from damlc

This means `damlc` now only supports versions allowing arbitrary expressions
as contract keys. This is very helpful for the upcoming new template
de/re-sugaring underpinning generic templates.

* Unpin a few DAML-LF target versions in tests

* Fix golden tests

* Adapt changelog to rebase

* Rename DAML-LF scenario tests to 1.dev

* Update tests to --target 1.dev

* Fix release notes
2019-06-03 14:00:25 -04:00
Moritz Kiefer
96fda7f4a0
Use haskell-lsp’s builtin VFS in "damlc ide" (#1489)
* Use haskell-lsp’s builtin VFS in "damlc ide"

haskell-lsp has a builtin VFS that it updates automatically on the
corresponding requests. This PR removes our own VFS implementation and
uses that builtin VFS in "damlc ide". To allow the use of functions
like setBufferModified (we use that heavily in daml-ghc-shake-test-ci)
without having to spawn an LSP server, we also add a fallback where we
spin up our own LSP implementation.
2019-06-03 16:19:30 +02:00
DavidM-D
2d4e426716 Added a barebones readme for haskell-ide-core as I've linked it from... (#1493)
...the zurihac project page
2019-06-03 14:03:15 +01:00
Shayne Fletcher
4747b1c186
Ghc lib 0.20190531 (#1486)
* Upgrade to ghc-lib-0.20190531

* Listen up Wally, Remove redundant commented code!

* Argh! WhattamistakeAtomakeA!

* Whitespace to force Azure pipeline to reconsider ignoring this PR

* Repackage ghc-lib, update SHAs and push again

* Refer to a non-existent release as an experiment

* Put the release number back

* Fix build of haskell-ide-core-public
2019-06-01 06:48:49 -04:00
Moritz Kiefer
60cb8f5271 Switch Hover from MarkedString to MarkupContent (#1473)
MarkedString is deprecated in LSP (both the protocol itself and the
Haskell library) so we should move away from it.
2019-05-31 13:43:36 +00:00
Remy
f84e7d79d2 Add enum type to daml-lf (#1397)
* add enum type to daml-lf dev

* Address Francesco's comments

* Address Martin's comments

* fix daml-lf proto version history
2019-05-29 12:15:01 +00:00
Anup Kalburgi
c0f4585033
Scenario header (#1285)
Scenario headers from type Constructor instead of data
2019-05-28 11:11:15 -04:00
Martin Huschenbett
80d7bf6ca3
Drop support for DAML-LF 1.2 from damlc (#1428)
This is part of #853.
2019-05-28 16:30:39 +02:00
Moritz Kiefer
330ede08b5
Separate diagnostics from rule results (#1423) 2019-05-28 14:18:59 +02:00
Martin Huschenbett
c1b98f8f1d
Back parseInt/parseDecimal by DAML-LF primitives when available (#1415)
* Back parseInt/parseDecimal by DAML-LF primitives when available

DAML-LF 1.5 introduces two new primitives `FROM_TEXT_INT64` and
`FROM_TEXT_DECIMAL`. We translate `parseInt` and `parseDecimal` to
these primitives when compiling to DAML-LF 1.5 or later.

This fixes #1398.

* Fix DAML-LF decoder (Scala)
2019-05-28 11:15:40 +02:00
Martin Huschenbett
2605f00804 Freeze DAML-LF 1.dev into DAML-LF 1.5 (#1408)
* Freeze DAML-LF 1.dev into DAML-LF 1.5

In other words, we release DAML-LF 1.5.

This is required for generic templates (#1387).

* description of FROM_TEXT_INT64 & FROM_TEXT_DECIMAL

* amend version history

add ``FROM_TEXT_INT64`` and ``FROM_TEXT_DECIMAL`` in the specification changelog

* typos

* Fix markup in DAML-LF spec

* Add release notes
2019-05-27 21:11:37 +00:00
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
Remy
4f18b1afa7 DAML-LF internal type safety (#1192)
* Rename Value's ContractId to VContractId

* daml-lf: a bit more about PartyId

* daml-lf: Concatenable MatchingStringModule

* daml-lf make clear type used for Scenarios only

* daml-lf create ContractId, LedgerId, TransactionId

* sandbox-sql conversion util

* LedgerName -> LedgerString

* futher type cleanup in the sandbox

* daml-lf add test for LedgerString

* fixing tests

* a bit more safety in the DB

* Address Stephen's comments

* fix rebase

* More fixes for StringModule

* change length of LedgerString (256 -> 255)
2019-05-24 09:53:29 +00: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
71d918e4f5 Remove use of Coercible from EncodeV1/DecodeV1 (#1305)
This is another cleanup after removing the `Tagged` anti-pattern.
2019-05-22 14:58:43 +00:00
Moritz Kiefer
4f0734c9f3 Fix an issue in module chasing caused by unnormalized file paths (#1303)
On Windows we can end up with rootModDir having / in the filepath
while rootPathDir uses \ so stripSuffix didn’t work.

This fixes #1284
2019-05-22 11:58:22 +00: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
Francesco Mazzoli
95e8dd01c7 Maintainers must be signatories (#1124)
* check that maintainers are a subset of signatories

fixes #1123

* add note on why `fetchByKey` gets you the contract data
2019-05-21 11:59:59 +00:00
Neil Mitchell
9e0400f6e1
Add a haskell-ide-core demo project (#1251)
* Demo program for haskell-ide-core as a library

* Fix all warnings in the Demo file

* Build the IDE demo

* Give a better error message than undefined

* HLint

* Fix copyright header

* Sort the dependencies

* Improve the comment

* Bazel formatting

* Disable building on Windows until ghc-paths is fixed

* Bazel formatting

* Specify the main function
2019-05-20 16:36:08 +01:00
Neil Mitchell
8b9d89e4cc
Move packaging logic out of haskell-ide-core (#1239)
* The PackageDynFlags instances are no longer required because its not a rule result

* Move all the package custom pieces out of the ide-core

* Move the optMbPackageName out to daml-ghc

* Make sure we clean up all temporary files

* Clean up the import list

* Move runGhcFast to its one use site
2019-05-20 12:05:21 +01: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
ed66eb4cf6
Refactoring: Replace Encode type class with monomorphic functions (#1228)
* Refactoring: Replace Encode type class with monomorphic functions

This type class thingy was just over-engineered (by me) and made changing
the code more complicated than it needed to be. I wanted to get rid of this
for a while now...

* Remove useless language extensions to make hlint happy
2019-05-17 21:00:33 +02:00
Martin Huschenbett
491e572f62 Turn a few standalone deriving clauses into proper deriving clauses (#1220) 2019-05-17 12:37:09 +00:00
Neil Mitchell
537eee7903
Delete redundant code (#1199) 2019-05-16 17:34:54 +01:00
Neil Mitchell
7c61967ea1
Remove NameCache modification in the IDE (#1189)
* Remove NameCache modification

* Change the suggested list of replacements
2019-05-16 16:01:26 +01:00
Martin Huschenbett
c11c565ea4
Move the DAML-LF version render/parse logic into LF.Version (#1190) 2019-05-16 16:35:54 +02:00
Neil Mitchell
2917e67ea4
Feedback from PR to improve import path finding (#1188)
* Feedback from PR to improve import path finding

* Update compiler/haskell-ide-core/src/Development/IDE/Functions/Compile.hs
2019-05-16 15:14:08 +01: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
Neil Mitchell
4772c537d6
Move to creating a single HscEnv that we reuse in all GHC sessions rather than a fresh one each time (#1179) 2019-05-16 13:17:17 +01:00
Martin Huschenbett
cbeccb79ec
Add complex contract keys to DAML-LF (#1162)
* Add complex contract keys to daml_lf_1.proto

* Adapt Haskell implementation of DAML-LF protobuf encoder/decoder

* Adapt Scala implementation of DAML-LF protobuf encoder/decoder
2019-05-16 13:46:01 +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
Neil Mitchell
abb8af60cf
IDE GHC 8.6 Compatibilty (#1148)
* Rename the #ifdef for GHC_STABLE

* More CPP required for GHC stable

* Add a compatibility wrapper for HIE functionality which is new in GHC HEAD

* HLint ignores

* Finish the dummy implementations

* Add a bazel build for the ide-core library against GHC
2019-05-15 11:21:21 +01:00
Shayne Fletcher
c135ccfa6b Upgrade to ghc-lib-0.20190514.1 (#1139)
* Upgrade to ghc-lib-0.20190514.1

* Whitespace fix.
2019-05-15 06:34:58 +00:00
Moritz Kiefer
ad10f98020
Fix SDK integration tests on Windows (#1125)
* Fix SDK integration tests on Windows

* Switch to Haskell-based tar extraction
2019-05-14 21:55:45 +02:00