Commit Graph

552 Commits

Author SHA1 Message Date
Robin Krom
6ccb18be08
language: put pkg version into pkgname (#2454)
This is a small step to solve the package name ambiguity problem.
Putting the package version into the package name allows to import a
package two times with different versions.
2019-08-08 16:31:09 +02:00
Martin Huschenbett
4d0a62801c Fix pretty printing of empty annotations in DAML-LF AST (#2453)
For example, we print two spaces if there's no annotation between `def` and
the function. This PR fixes this by using the `empty` document instead of the
document containing the empty string. (Please don't ask me why they are
different.)
2019-08-08 12:11:56 +00:00
Moritz Kiefer
c5664fe5b5
Speed up dependency information chasing (#2444)
Comparing FilePaths is really slow so by mapping them to Ints, we can
speed up dependency chasing significantly.

We might want to switch to doing some kind of global hash consing of
file paths at the Shake level but for now, this seems like a nice
improvement while not being too invasive.

This is roughly an ~8s speedup on my testcase.
2019-08-07 16:51:38 +02:00
Martin Huschenbett
966dfbd400 Add test for manually desugared form of the generic proposal workflow (#2442)
Having a test that demonstrates how the desugared form of the template syntax
looks like seems to be a good idea.
2019-08-07 11:53:52 +00:00
Moritz Kiefer
b3e1833e71
Use FastString where possible and speed up conversions to Text (#2436)
This cuts allocations on my testcase by about 2% and provides a
similar speedup.
2019-08-07 11:03:40 +02:00
Martin Huschenbett
c0a07e7e07
Use template syntax in IOU proposal test (#2435)
Until now the test used the manually desugared syntax for the `Iou`
template. Now, we use the proper `template` syntax. The test is also
renamed from `IouDSL` to `ProposalIou` since the DSL would be confusing
after this change. In fact, we're mostly testing that the
instantiation of `Proposal a` with `a = Iou` actually works.
2019-08-07 10:04:45 +02:00
Martin Huschenbett
c63782791e Remove tests that are obsolete with new template desugaring (#2434)
* Remove tests that are obsolete with new template desugaring

The tests were only relevant during the transition phase to the new
template desugaring. Since that desugaring has landed the test don't
provide value anymore and can be deleted.

* Fix super class dictionary detection
2019-08-06 18:22:49 +00:00
Moritz Kiefer
d95d25fd2f Speed up convertModuleName (#2432)
On my testcase, this cuts allocations by about 6%.
2019-08-06 18:14:34 +00:00
Martin Huschenbett
15f94783d8
Use tasty-golden for daml-doc's golden tests (#2429)
* Use tasty-golden for daml-doc's golden tests

With our hand rolled version of golden tests it is pretty painful to update
the golden files when they must change. After this PR it is as simple as
```
> bazel run //compiler/damlc/tests:daml-doc -- --accept
```

* Address indentation issues

* Use diff command line tool for diffing

* Removed new unused dependecy on Diff package

* Ignore carriage returns in diff
2019-08-06 19:47:52 +02:00
Shayne Fletcher
1308c8232b
hlint => dlint everywhere (#2409) 2019-08-06 13:42:36 -04:00
Moritz Kiefer
180313b404
Unrecursionschemify freeVars calculation (#2427)
This cuts allocations and speeds things up (admittedly not by a whole
lot) but it also lets us delete a bunch of code which is always nice.
2019-08-06 19:33:11 +02:00
Anup Kalburgi
629266a445
Addressing comments on a previous PR #2371 (#2408) 2019-08-06 12:48:54 -04:00
Moritz Kiefer
859ac379de
Move simplification to GenerateRawDalf (#2424)
This allows us to GC the unsimplified DALF which decreases memory
usage and GC pressure. This does make GenerateRawDalf slightly slower
which could in theory have an effect on IDE performance since we use
the raw DALF for the scenario service. However, I haven’t been able to
measure any regressions (if it does become an issue, we could disable
optimizations completely in the IDE). In fact, things seem to be
slightly faster.

On my testcase max memory usage does seem to go down a bit but not a
lot (3.0GB to 2.7GB but it fluctuates somewhat between runs).
2019-08-06 16:40:29 +02:00
Martin Huschenbett
d723db8fca Simplify test for different choice syntaxes (#2405)
* Simplify test for different choice syntaxes

* Test for scoping rules of flexible controllers as well
2019-08-06 14:19:47 +00:00
Moritz Kiefer
a1ac927add
Avoid converting DARs to a strict bytestring (#2423)
Converting it to a strict bytestring only to then write it to disk
doesn’t make much sense.
2019-08-06 16:16:14 +02:00
Moritz Kiefer
d630b7134d
Activate VSCode extension on daml.resetTelemetryConsent (#2421)
Otherwise, you will get an error if you run the resetTelemetryConsent
command without having opened a .daml file.
2019-08-06 14:43:35 +02:00
Shayne Fletcher
c8783d08bb Upgrade hlint (#2406)
* Upgrade hlint

* Reduce duplication
2019-08-05 18:45:31 +00:00
Martin Huschenbett
3a02b56117 Merge the Iou12 and Iou_template test into one test (#2407)
They differ only marginally and I don't see any reason why they should be
two different tests.
2019-08-05 17:14:59 +00:00
Martin Huschenbett
ecc66604b5 Simplify test for unserializability check (#2404) 2019-08-05 17:05:12 +00:00
Martin Huschenbett
f669d7e572 Remove the old template resugaring from the GHC Core -> DAML-LF conversion (#2400)
Since we changed how the parser desugares templates, this code path won't be
hit anymore.
2019-08-05 16:38:11 +00:00
Moritz Kiefer
a967b872e2 Use a single map for RawDependencyInformation (#2399)
This cuts allocations a bit and makes things slightly faster (sadly
not a lot).
2019-08-05 16:21:36 +00:00
Rohan Jacob-Rao
4fc121db60 Use template-let-bound function in signatory decl (#2401) 2019-08-05 16:10:15 +00:00
associahedron
9042d14cb1 Damldocs qualified flag (#2394)
* Rename HaddockParse -> Extract

* Add --qualify-types option.

* More qualified type options

* Update help text

* Update compiler/damlc/lib/DA/Cli/Damlc/Command/Damldoc.hs

Co-Authored-By: Jost Berthold <jost.berthold@digitalasset.com>

* Accidentally left in a testing change.

* Documenting DocCtx fields

* Mark new options internal
2019-08-05 13:23:58 +00:00
Moritz Kiefer
4a265e5399 Enable TypeApplications in daml-lf-ast.cabal (#2395)
We started using this recently which broke the cabal build.
2019-08-05 12:55:44 +00:00
Moritz Kiefer
705f014a88 Fix daml build for usernames with spaces (#2392)
* Fix daml build for usernames with spaces

This PR fixes two issues caused by having spaces in your username:

1. On Windows, we need to quote the path to the daml binary in the
batch wrapper (quotes are not valid in usernames, so no need to worry
about escaping them).

2. Invoking ghc-pkg via callCommand broke since shells are
terrible. Luckily, we can easily get away with just using callProcess
here.

* Update compiler/damlc/lib/DA/Cli/Damlc.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-08-05 08:49:40 +00:00
Moritz Kiefer
482a01dacf
Speed up dependency chasing (#2383)
This PR moves as much work as possible to GetLocatedImports which
contracry to GetDependencyInformation is shared between rules.

It’s still slower than it should be and somewhat messy but at least
it’s slightly faster and imho cleaner than before.
2019-08-05 09:31:14 +02:00
Rohan Jacob-Rao
9527fd044d Test template level let with keys (#2387) 2019-08-02 21:17:56 +00:00
associahedron
7d165a7511 damldocs: Switch to mustache templates. (#2373)
* damldocs: Switch to mustache templates.

* Update cli help and release notes.

* Move to stache
2019-08-02 13:52:38 +00:00
Moritz Kiefer
393aa14e11
Make --shake-profiling use the directory based profiling (#2378)
* Make --shake-profiling use the directory based profiling

The single-file based profiling is rather useless in the IDE and I
always found myself having to modify the source to set `profileDir` so
this PR switches the CLI option to control that instead.

* Add --shake-profiling to damlc ide
2019-08-02 15:21:40 +02:00
Anup Kalburgi
6f8edb86b1
Visual Checking actual actions instead of number of actions
Visual Checking actual actions instead of the number of actions
2019-08-01 18:25:04 -04:00
Martin Huschenbett
7cebdb7c17 Shrink stack size on Windows in bond memory test (#2358)
We increased it by too much in order to get tests to pass earlier. Now we shrink it to something closer to what we had before.
2019-08-01 13:45:27 -04:00
Anup Kalburgi
e5a0206a62
Visual tests - Avoid using golden file tests (#2325) 2019-07-31 15:49:53 -04:00
Neil Mitchell
6dd5e04576 Fix up the .ghci file for hie-core to track recent changes (#2322) 2019-07-31 21:15:40 +02:00
associahedron
35ee96a613 damldocs: Unify output across formats. (#2351)
* Unify rst and md output in damldocs.

* Fix errors

* Define RenderUnwords / RenderIntercalate in terms of RenderConcat

* Delete the old

* Small output format changes and update golden tests

* Fix table rendering and tests.

* Fix golden test.

* Delete more old

* Implement reviewer suggestions
2019-07-31 17:34:52 +00:00
Robin Krom
8fe537e292
Dar building cleanup (#2357)
* reorganizing dar building
2019-07-31 18:34:41 +02:00
Gary Verhaegen
0c154b7948 add set -e to vsix production (#2359) 2019-07-31 15:10:30 +00:00
Moritz Kiefer
72695ec310 Optimize mangleIdentifier (#2350)
* Optimize mangleIdentifier

I am slightly embarassed by importing Data.Text.Internal and
Data.Text.Array. However, this does make a very measurable difference:
On my testcase it brought down the time encoding modules from 22s to
17s, so it’s a 5s improvement.

I did quickcheck this against the old implementation, so I’m confident
it behaves correctly. I also ran some criterion benchmarks to see the
difference and on its own it’s even more of a difference.

https://gist.github.com/cocreature/822114257227473ecff1638a88f07788

* GHC is stupid :(
2019-07-31 14:07:36 +00:00
Robin Krom
3db5230a43
language: put hash in package directories (#2268)
* language: put hash in package directories

We put the package id of the main dalf of a package into the directory
names, where we store the files of that package in the package database.
This way we make sure that two equally named packages don't overwrite
their dependencies and files.
2019-07-31 14:31:45 +02:00
Moritz Kiefer
4cd35cccca
Add a Stack based pipeline for testing hie-core (#2348)
This is in preparation for #2326 as well as for splitting hie-core
into a separate repo. Given that, it explicitely avoids using our
dev-env.

We do need to install a few system packages, so for now this uses the
hosted builder so we can do this. Another option would be to just add
those to our builders. I don’t really have a preference either
way. The builds are < 5 minutes so I don’t expect issues from using
the hosted builders.
2019-07-31 11:24:37 +02:00
Shayne Fletcher
f220100ab8
Enable linting in 'defaultOptionsIO' (#2343) 2019-07-31 05:08:36 -04:00
Stephen Compall
c483da3eb9 use MonoTraversable ModuleRef in place of Generic HasPackageRef (#2327)
* compiler: simpler packageRefs traversal

* compiler: include ModuleRefs in SourceLoc

* ignore the ModuleRef when traversing SourceLoc

- see https://github.com/digital-asset/daml/pull/2327#discussion_r308445649
2019-07-31 07:22:42 +00:00
Rohan Jacob-Rao
e6a4d8b251
New template desugaring (#2178)
* Update ghc-libs to use new template desugaring
* Replace old template typeclasses with generic-friendly ones
* New template desugaring doc
* Fix tests
* Fix damldoc tests regarding Archive choice
* Update visualisation code to not traverse master dictionary
* Additional class method stubs to template instance declaration for upgrades
* Increase stack limit for bond trading compilation test
* Update hlint version
2019-07-30 19:49:33 -04:00
Shayne Fletcher
b3dac78e66
hlint.yaml => dlint.yaml; globally disable "use newtype" hint (#2341) 2019-07-30 14:39:46 -04:00
Shayne Fletcher
8532316c3a
Enable linting in the IDE! (#2339) 2019-07-30 11:57:52 -04:00
Moritz Kiefer
50a04397e4
Supporting producing sdist tarballs for the HS ledger bindings (#2336)
* Supporting producing sdist tarballs for the HS ledger bindings

The README.md has an explanation for how you can use this.

This should hopefully allow others to experiment with the bindings.
2019-07-30 14:34:16 +02:00
Shayne Fletcher
18ecf0ee8c
Support per-project hlint customization (.dlint.yaml files) (#2328)
* Support per-project hlint customization (.dlint.yaml files)

* Simplify logic with 'foldMapM'
2019-07-30 07:41:11 -04:00
associahedron
29fa387910 Move GHC.Classes docs to Prelude, hide IP. (#2333) 2019-07-30 11:15:05 +00:00
Moritz Kiefer
e415527e3e
Speed up identifier mangling (#2320)
My benchmark is sadly extremely noisy which makes it hard to figure
out how much of an improvement this is but it does seem to at least be
a minor improvement.
2019-07-30 08:50:51 +02:00
Remy
0ffe5945b8 DAML-LF: Prepare archive proto for Numeric (#2298)
* daml-lf: prepare archive proto for Numeric

* replace DECIMAL by NUMERIC in messages and fields
* add nat kind and nat type
* add builtins CAST_NUMERIC and SHIFT_NUMERIC

* daml-lf: remove new builtins from archive proto

* daml-lf: some more doc about numeric

* daml-lf: fix spec
2019-07-29 18:33:52 +00:00
nickchapman-da
b90862ebec
improve haskell module hierarchy to be more consistent (#2319) 2019-07-29 15:55:55 +01:00
Moritz Kiefer
ce5fe424fc
Speed up file modification checks (#2317)
Speed up file modification checks

Summary: `getModificationTime` from the `directory` package is really
slow. The `unix` package is faster but still slow. This PR brings the
time spent checking file modifications (which is required on every
change) from ~0.5s to ~0.15s.
2019-07-29 16:19:32 +02:00
associahedron
462a852a03
Anchor links in Rst docs, fixing type rendering, and refactoring. (#2315)
* Add anchor self-links in Rst docs

* Refactor a little with unwords

* Fix silly type error

* Refactoring and better type rendering

* Rename rst renderer functions.

* Update tests

* lint
2019-07-29 12:28:37 +01:00
associahedron
2a17b3d191 damldocs: Drop --json flag, update release notes. (#2309)
* Drop --json flag, update release notes.

* Clean up import list
2019-07-29 07:19:01 +00:00
Robin Krom
5bdc0d1b37
language: a shake rule to get interface/hie files (#2291)
* language: a shake rule to get interface/hie files

This adds a shake rule to get module interfaces and hie files. This
gives more control on when to build them and also an opportunity to
change the package name after typechecking. This is used in the next
PR to add package hashes to the package name in the interface files.

* generate hie files only on demand
2019-07-26 15:06:20 +02:00
associahedron
3d6f740964
damldocs: Hook up multiple file rendering to cli options. (#2295)
* Hook up multiple file rendering to cli options

* Fix --output help

* Fix bazel rules, boo

* Fix rule again

* Address reviewer comments
2019-07-26 13:45:06 +01:00
Moritz Kiefer
a7bb901052
Avoid evaluating modules unnecessarily to NF (#2296)
Currently, we call `force` on every result of a rule. This was
problematic for the rules that produce LF packages:

Even if only the top-level module changes, the package for that module
contains all its dependencies. This means that we end up RNFing every
module that the current module depends on. On a project with ~900
dependencies this added up to over 1s for both GeneratePackageDeps and
GeneratePackage which corresponded to more than half of the overall
runtime.

This PR introduces a newtype for packages that does not evaluate the
modules in a package to NF. With this PR both rules are below 0.02s so
his is quite a significant improvement. We do not introduce any
potential space leaks here since the modules are produced by rules
that already force them to NF.
2019-07-26 14:11:43 +02:00
Andreas Herrmann
5f550e852e Fix hanging hie-core tests with stack (#2293) 2019-07-26 12:08:51 +00:00
Andreas Herrmann
fc388b038f stack/cabal for hie-core-tests (#2287)
* stack/cabal for hie-core-tests

* ./fmt.sh
2019-07-25 12:50:07 +00:00
Moritz Kiefer
da9fb464db Improve debugging output (#2281)
* Improve debugging output

Displaying the exception makes it easier to figure out what is going
wrong.

I’ve also added a HasCallStack constraint to `locateRunfiles` since it
looked like that was failing. Turned out to be a call to `create` that
didn’t go via `locateRunfiles` but I think it’s useful either way.
Should be more useful with https://github.com/tweag/rules_haskell/pull/1007

* Update compiler/hie-core/src/Development/IDE/Core/Shake.hs

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-07-25 10:33:57 +00:00
Shayne Fletcher
ee5079d9d3 Ghc lib 8.8.0.20190723 (#2279)
* Upgrade ghc-lib

* Patch bazel_tools : hazel-include-paths patch, no-isystem patch.

* Provide "haskell_c2hs" for package name to cabal_haskell_package

* Package name haskell_c2hs => c2hs.

* Switch to less hacky patch for include dirs
2019-07-25 08:59:34 +00:00
Martin Huschenbett
8d8b09c45f damlc visual: detect ledger actions at surface level (#2278)
* damlc visual: detect ledger actions at surface level

Instead of detecting the DAML-LF primitives for `create` and `exercise`,
we detect the corresponding surface DAML functions and ignore the
dictionaries for the `Template` and `Choice` classes. This will be
necessary for swiching to the new template desugaring.

This is the quickest way to get this working but might turn into a brittle
maintenance nightmare one day. If that happens, we should switch to doing
proper symbolic evaluation, which will we be a bit more code though.

* Fix explanation

Co-Authored-By: Rohan Jacob-Rao <rohanjr@gmail.com>

* Add explanation for special casing archive
2019-07-24 21:42:28 +00:00
Fran
16259ab00f
damldocs: Make function types mandatory. (#2274) 2019-07-24 11:22:17 +01:00
Fran
000ccfc86e
damldocs: Use blockquotes for layout in markdown rendering. (#2273)
* Use blockquote for layout

* Update tests
2019-07-24 10:30:52 +01:00
Fran
1bf9adf44e
damldocs: Reinstate contexts in markdown function docs. (#2269)
* Reinstate contexts in markdown function docs.

* Simplify missing types logic

* Fix rst rendering for sphinx
2019-07-24 09:03:33 +01:00
nickchapman-da
b30228ab95
{-# LANGUAGE OverloadedStrings #-} is now on by default (#2270) 2019-07-24 08:09:26 +01:00
Fran
d0dd201380
damldocs: Backend for rendering docs to multiple pages. (#2259)
* Begin multi-page rendering

* Fixed multi-file output rendering for HTML

* Remove renderSimpleHtml

* Remove unnecessary imports

* Remove unused lang extensions

* Address reviewer comments
2019-07-23 19:04:10 +01:00
Moritz Kiefer
5f3e4b4b35 Add property tests for PositionMapping (#2265) 2019-07-23 15:05:44 +00:00
Moritz Kiefer
80360af18b
Support depending on potentially stale values in damlc (#2257)
* Support depending on potentially stale values in damlc

For now, this is opt-in and only enabled for the scenario service.
Locations should be properly mapped so if lines are inserted above a
scenario, the scenario link will move down.
2019-07-23 15:00:21 +02:00
Martin Huschenbett
35dc1848a2 Erase key lookup methods implemented using magic as well (#2252)
* Erase key lookup methods implemented using magic as well

We're already erasing `create`, `fetch` and `exercise` methods. I've
missed the ones related to key lookups when I did that. This PR fixes
my mishap.

* Fix typo in docs.

Co-Authored-By: Rohan Jacob-Rao <rohanjr@gmail.com>
2019-07-22 19:18:14 +00:00
Martin Huschenbett
a35af9697f
Hide the --target flag of damlc (#2253)
We want to discourage users to pin down a target DAML-LF version but rather
want them to always use the default version, which is typically the newest
version. Thus, we turn this into an expert flag that is mostly used for
testing by us.
2019-07-22 20:43:22 +02:00
Martin Huschenbett
3076aeb239 Remove DA.Daml.LF.Decimal module (#2251)
The module was only used to format decimal numbers. The only impact the
formatting could have had was to add/strip trailing zeros from the
presentation of the number. However, manual testing shows this did not
happen. Thus, the whole module is now useless.
2019-07-22 17:55:30 +00:00
Martin Huschenbett
82ef3e47cf Generic templates: erase default implementations of magic methods (#2249)
`template X` generates type class `XInstance` which contains a few methods
which are implemented in terms of `magic` and then rewritten during the
conversion to DAML-LF. The default implementations of these methods need to
be erase during the conversion to DAML-LF since `magic` is erased as well.
2019-07-22 16:57:01 +00:00
Martin Huschenbett
4acaa0abdd Prefix method names in generic template classes with underscore (#2248)
We will do this as part of desugaring the surface syntax to occupy less
precious namespace.
2019-07-22 15:07:53 +00:00
Robin Krom
20fde9fd98 language: added a merge command to damlc (#2232)
* language: added a merge command to damlc

This adds a 'merge-dars' command to damlc to merge two dars into one.
This is useful when you created an upgrade dar and want to ship it as
part of the latest version of a package.

* added a comment on nubSort for clarity
2019-07-22 14:04:28 +00:00
Fran
a324102a19
damldocs: Document template instances. (#2240)
* Add md_templateInstances field and TemplateInstance docs.

* Extract template instance docs from adt docs

* Turn template instance map into a set.

* Output template instances

* Refactor rst sections

* Remove extra line

* Use doc marker to detect template instances

* Remove lint

* Implement review suggestions
2019-07-22 14:48:12 +01:00
Andreas Herrmann
e2a424e5fc hie-core/test: Dedicated test suite for hie-core (#2243)
* hie-core/test: Dedicated test suite for hie-core

* Apply hlint suggestion

Use System.Environment.Blank's setEnv which has a non-overwrite mode
that implements precisely what we were doing with more code before.

* buildifier fixes

* hie-core-exe works on Windows now - ghc-paths was fixed
2019-07-22 13:42:04 +00:00
Moritz Kiefer
46a8737d82 Ignore optional notification and request methods (#2244)
* Ignore optional notification and request methods

* Update compiler/damlc/daml-ide/src/DA/Daml/LanguageServer.hs

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>
2019-07-22 13:12:36 +00:00
Robin Krom
c8e0f51e90
Address martin comments (#2242)
addressing martin's comments
2019-07-22 13:48:29 +02:00
Michał Majcherski
148d2a57d3
VSCode scenario codelenses improvements (#2141) 2019-07-22 10:50:30 +02:00
Moritz Kiefer
cb83a32ccd
Use a custom Value type instead of Maybe for storing rule results (#2237)
This is a refactoring-only PR in preparation for supporting stale
values in damlc so we can still produce some results if a rule fails
to produce a value but has a stale value stored.
2019-07-22 10:46:37 +02:00
Moritz Kiefer
4cd5766ab4 Remove duplication from PrettyScenario (#2236)
While experimenting with the pure Haskell gRPC implementation I
noticed that there is a fair amount of duplication in PrettyScenario
so this PR cleans up some of that.
2019-07-22 08:26:48 +00:00
Moritz Kiefer
f9fbfaeed2
Fix gRPC issues in damlc (#2230)
The gRPC library does not handle asynchronous exceptions properly and
ends up leaking things which causes various issues (segfaults,
assertion failures, weird backup poller timer messages, …) when
shutting down gRPC.

The switch to grpcShutdownBlocking is somewhat unrelated (the issues
happen with and without that and the fix seems to work both times) but
that function seems to be the right way to shut down gRPC in newer
versions and is what all the official language bindings switched to,
so I also made the switch.

I haven’t yet looked into the issues in the HS ledger bindings so not
sure if this helps with those as well.
2019-07-19 16:38:48 +02:00
Robin Krom
fd82ec73ab
language: generate upgrades independent of daml-prim (#2228)
This finally allows upgrades to be generated independent of the
daml-prim package.
2019-07-19 16:29:47 +02:00
Robin Krom
2b110f88e6
Upgrades independent of stdlib (#2222)
* language: upgrades independent of stdlib

This fixes several issues in the code generation from dalfs. As a result
we can now generate upgrades independent of the stdlib source.
2019-07-19 13:36:01 +02:00
Martin Huschenbett
37b7820942 Import the IDE modules unqualified instead of as Compile(rService) (#2227)
Some `Development.IDE.*` modules were imported qualified as either `Compile`
or `CompilerService`. These names are at least odd and maybe also
misleading. Since there's no actual need to import them qualified, let's
just import them not qualified.
2019-07-19 10:05:49 +00:00
Anup Kalburgi
bdddad4d76 Handling Dalfs list in Manifest file (#2207)
* handling dalfs flowing to next line

* space not blank

* Lints and space

* fixing the test names

* filter using not.null

* Using fold instead. makes reading easy

* Format everything

* Removing use of partial function
2019-07-18 15:31:52 +00:00
Martin Huschenbett
c113378482 Drop two useless occurences of 'import ... as Base' (#2216)
They don't serve any purpose and are just noise.
2019-07-18 13:53:57 +00:00
Fran
9f93362d44 Fix MOVE in GHC.Enum (#2215) 2019-07-18 13:40:09 +00:00
Martin Huschenbett
fab77c8092
Enable GHC Core linter in damlc integration tests (#2206) 2019-07-18 10:26:03 +02:00
Beth Aitman
d9e079df39 More stdlib tweaks (#2203)
* More stdlib tweaks

* Another commit to kick off build again

* Fix incorrect docs syntax

* Apply suggestions from code review

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Apply suggestions from code review

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* More suggestions applied
2019-07-17 17:05:10 +00:00
Fran
c3f798610f
Fix Rst typeclass headers, simplify/fix typename anchors, make type declaration docs more robust. (#2202) 2019-07-17 15:13:17 +01:00
Martin Huschenbett
885aed9e0a In damlc session setup, pass options record around (#2193)
... rather than individual option fields. This prepares a change where I want
to add another option which needs to find its way into `adjustDynFlags`.
2019-07-17 13:29:30 +00:00
Martin Huschenbett
f38d717433 Support reading of DAML-LF 1.5 in damlc again (#2180)
* Support reading of DAML-LF 1.5 in damlc again

We dropped support for this for no good reason when we dropped support for
writing DAML-LF 1.5. Being able to _read_ older versions of DAML-LF is
important for the upgrading story.

We don't support reading older versions of DAML-LF since there seems to
be no need for this.

* Fix integration test
2019-07-17 11:34:53 +00:00
Fran
f9bb9dc149
damldocs: Show generic template args and context. (#2181)
* Collect generic template args and context

* Revert template anchor change (keep it separate)

* Output generic template args and context in Rst docs

* Add template args and context in Md output
2019-07-17 11:58:55 +01:00
Shayne Fletcher
e735b16c40 Rephrase lint exit actions (#2182) 2019-07-17 10:57:59 +00:00
Beth Aitman
cd514eb024 Stdlib doc edits (#2163)
* Stdlib doc edits

* Apply suggestions from code review

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update based on Moritz's suggestion

* Fix ledger-api-integration-tests
2019-07-17 07:54:13 +00:00
Andreas Herrmann
63b46304eb
Base DA.Bazel.Runfiles on bazel-runfiles (#2147)
* DA.Bazel.Runfiles based on bazel-runfiles

* locateRunfilesMb -> locateRunfiles

* .exe extension on Windows

* Add docstring to locateRunfiles

* bazel-runfiles: Normalize on Windows
2019-07-17 09:48:44 +02:00
Fran
4a125ef963
damldocs: Recognize generic templates, choices, and template instances. (#2179)
* Add test for recognition of generic template.

* Recognise a generic template

* Recognize choices

* Recognize template instances

* Update getTemplateData haddock
2019-07-17 08:46:54 +01:00
Shayne Fletcher
2799c1c7cc Add damlc command 'lint' (#2177)
* Add damlc command 'lint'

* Tidy up

* Say "No hints" (like hlint.exe) when there's nothing to suggest
2019-07-16 21:37:29 +00:00
Robin Krom
bde8af18c9
language: correct translation of sums of products in daml code gen (#2169)
* language: correct translation of sums of products in daml code gen

We fix the translation of data type constructors with several name
components for sums of products in the translation from daml-lf back to
source.
2019-07-16 22:40:22 +02:00
Gary Verhaegen
b8d356d8e3 enable old extension test (#2103) 2019-07-16 18:12:48 +00:00
Martin Huschenbett
d5d08707c2 Drop support for DAML-LF 1.5 from damlc (#2161) 2019-07-16 13:52:29 +00:00
Moritz Kiefer
5aa3cba949
Add a damlc doctest command and test the standard library (#2157)
There is lots of room for improvements here but I think this is a good
first step. The 3 main things that could be improved imho are:

- Rewrite source locations to point to the original file rather than
  the generated module

- Provide some way to declare things like imports or more general,
  setup code that is added to the generated module.

- Prettier/more helpful output during a run, e.g., print the list of
  successful tests.
2019-07-16 15:51:01 +02:00
Fran
0fc0ca6574
damldocs: Anchors and type signature links for markdown output. (#2156)
* Move renderer monoid to its own module.

* Markdown rendering

* Add md stdlib bazel rules

* Update damldoc tests
2019-07-16 13:53:15 +01:00
Fran
7324a5d8a7 Prune DA.Generics and fix up some docs. (#2153)
* Prune DA.Generics and fix up some docs.

* Add more --

* :flame-emoji:
2019-07-16 12:12:44 +00:00
Robin Krom
aff7f1bc67
Generate interface files from dalf (#2151)
* language: upgrading: generating interface files
2019-07-16 13:46:43 +02:00
Anup Kalburgi
ddd96a05ce Same chouce name visual (#2152)
* internal name

* Adding internal choice name

* correct but ugly

* no more awkard underscore for create and archive

* not more underscores

* creating archive is not necessary

* simplify

* Removing duplicate

* simplified code

* Using cons intead of ++

* not needed parans

* Formatting
2019-07-15 19:57:20 +00:00
Shayne Fletcher
1bdf212f47
Eliminate the maybe in the hlint option (#2145)
* Eliminate the maybe in the hlint option

* Allow multiple `--with-hlint ...`, `--without-hlint` flags

* Use 'lastMay'
2019-07-15 11:11:37 -04:00
Shayne Fletcher
4f3c4f828f
Improve diagnostics of hlint ideas (#2139)
* Improve diagnostics of hlint ideas

* Zero based
2019-07-15 07:21:57 -04:00
Fran
e30955963b damldoc: Derive missing type signatures and add links in type signatures. (#2132)
* Use type information in function docs

* idpToText -> packRdrName

* Use tycon to get superclasses

* Make anchors from tycons

* Generate all type anchors with tyConAnchor

* Type information is everywhere

* Render links.

* s/missing/available/

* Update golden tests

* Hlint / refactor

* Clean up import list

* Banish evil

* Catch lint

* Use mapMaybe

* Use list comprehensions instead

* packModule -> getModulename, dc_mod -> dc_modname

* Deal with tuple constructors properly

* Update the test case

* Better docs in Rst renderer

* Add test that uses type sig links

* Update release notes
2019-07-15 11:06:01 +00:00
Shayne Fletcher
a85fee85b3
Improve hlint options handling (#2138) 2019-07-15 05:41:06 -04:00
Gary Verhaegen
e2d9541c8c bundle vsix in sdk tarball (#2113) 2019-07-12 21:35:05 +00:00
Remy
e7bbf87692 Freeze DAML-LF version 1.6 (#1937)
* daml-lf: cosmetic

* daml-lf: release V1.6

* daml-lf: update spec

* update unreleased.rst

* Address Martin's comments

* damlc: active daml-lf-target 1.6

* lf-encoder: fix testing dar generation

* daml-lf spec: simplify 1.dev description

* daml-lf: fix engine test

* daml-lf: fix version timeline

* extractor: fix test

* Address Stephen's comments

* Add more meat to the release notes

* java-codegen: update docs

* damlc: set 1.6 as default output version

* java-codegen update integration tests

* undo replicating typo

* release notes

* scala-codegen: update test

* java-codegen: fix doc

* extractor: fix  test

* address Gerolf's comments

* realse-notes: cleanup unreleased.rst

* Address last comment from Stephen

+ cosmetic cleanup

* formatting
2019-07-12 19:06:44 +00:00
Shayne Fletcher
dd77ea99e1 remove filegroup now there's only hlint.yaml (#2133) 2019-07-12 16:57:37 +00:00
Shayne Fletcher
dcd20ace8a Daml hlint integration (#2115)
* Get draft rule in

* Hlint is now firing

* First hlint unit test

* This gets hlint working in the ide

* Select hlint.yaml contextually. Wip

* Fix prod path

* Switch between prod and test versions of hlint.yaml

* Format

* Ignore hlint hints in the language tests

* Add some debugging stuff. LSP stress test is broken

* Update compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Tidy up some details

* Simplify settings (remove unused parseFlags)

* Fix LSP stress tests

* ./fmt.sh

* Collapse to one hlint.yaml, provide options

* Fix location of hlint runfiles

* Disable hlint by default; enable for shake-ide tests

* lint (ironic)

* Remove filtering of lints from integration test

* ./fmt.sh

* Respect the flag

* Silence opininated lint

* Update compiler/damlc/daml-opts/daml-opts-types/DA/Daml/Options/Types.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Update compiler/damlc/lib/DA/Cli/Damlc.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* I really did mean optHlintEnable here

* Move hlint enabled check to ofInterest like shouldRunScenarios

* Rename variable

* Cache settings

* Missed a merge conflict

* lift liftIO

* Remove the hlint-testing POC

* use useNoFile_
2019-07-12 16:17:06 +00:00
Anup Kalburgi
31319c219d Removing redundant data (#2116)
* Removing redundant data

* Adding some comments

* handling the duplicate acchive option

* renaming record field

* using plural

* Tpl name
2019-07-12 15:29:39 +00:00
Moritz Kiefer
6fb2703d6d Add useNoFile helpers matching defineNoFile (#2126) 2019-07-12 15:06:03 +00:00
Robin Krom
0f718eb371
language: fixed qualification in generated code (#2124)
we make sure the right things are qualified and the right things are not
qualified in generated code. we also add GHC.Types always to the imports
because it's potentially used by native types such as 'Int' and we don't
import Prelude.
2019-07-12 16:42:28 +02:00
Robin Krom
9a24c4a866
language: additional (hidden) compiler options needed for migrate (#2123)
This adds two compiler options ifaceDir and isGenerated to the compiler
options. These will be needed to write generated interface files to the
right directory and treat generated source files special when generating
interface files.
2019-07-12 16:41:10 +02:00
Moritz Kiefer
25c0052bce
Fix VSCode extension (#2117)
There were two issues:

1. VSCode changed their packaging so we now need to depend on
`@types/vscode`. This broke `yarn run compile`. I have no idea why
this did not cause an error in the Bazel build. Presumably the giant
tsconfig that it generates was doing something different.

2. We excluded src/webview.js in .vscodeignore which means that it was
not included in `vsce package` and thereby also not in the extension
included in the marketplace.
2019-07-12 11:09:37 +02:00
Moritz Kiefer
48a3f77c4f
Report progress in VSCode (#2112)
For now, we only show a “Progressing” message and a done/todo
indicator. We could eventually try to come up with something better
but I’m not quite sure what that would be since we try a lot of things
in parallel and the triggering request isn’t particularly
useful (users won’t know what a codelens request is and why they have
to wait for it).

Note that VSCode seems to have some delay in updating these
notifications so you only see the done/todo reports if it is
processing for a while.
2019-07-11 17:49:23 +02:00
Fran
ed904d1855 damldocs: Generate doc anchors at doc extraction. (#2109)
* Generate anchors in haddock parse.

* Simplify function anchors.

* Fix tests

* Fix golden test

* Fix empty doc test.
2019-07-11 15:22:11 +00:00
Moritz Kiefer
1083b23fc0
Use a separate thread for sending GCP log messages (#2102)
Apart from simplifying the code, this should also make startup
significantly faster in some cases, e.g., when the initial log request
times out.
2019-07-11 13:19:02 +02:00
dependabot[bot]
a04ee44eb4 Bump urllib3 from 1.24.1 to 1.24.2 in /compiler/daml-licenses/licenses (#2082)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.24.1 to 1.24.2.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/master/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.24.1...1.24.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-10 20:57:10 -04:00
Anup Kalburgi
dfe5d15708 correcting the sytax as it breaks the dot command (#2094) 2019-07-11 00:00:25 +00:00
Rohan Jacob-Rao
55e3f7e106
Fix record dot preprocessor for class declarations (#2095)
The preprocessor was skipping over default method declarations.
2019-07-10 17:08:59 -04:00
Anup Kalburgi
22957ca06a
Color coding the consuming and non-consuming choices in graph (#2079)
Adding consuming and non consuming choice with colors
2019-07-10 12:30:32 -04:00
Gary Verhaegen
a4ea880cf3
get vsce through Bazel rather than nix (#2090) 2019-07-10 15:36:43 +02:00
Fran
8b31d5bb16 Apply annotations to JSON input. (#2087) 2019-07-10 09:47:23 +00:00
Fran
a8f98172c9 damldoc: Move towards extracting information from TypecheckedModule in HaddockParse. (#2013)
* Run typechecker in damldocs (but don't use result yet)

* Add Modulename to TypeApp constructor.

* Add md_name where appropriate.

* Thread a DocCtx through each doc extractor.

* Move template set and choices map into docctx

* Use Typename for template set and choice map

* Make Anchor a newtype and move it to Types

* Make Modulename in TypeApp an Anchor instead.

* Remove import of hidden module.

* Qualify that which doth need be qualified

* Update tests

* Build stdlib in such a way that it passes typechecking.

* Update release notes.

* Remove MOVE Prelude directives in daml-prim.

* Use optional in damldoc options

* Update function hashes

* Compile base packages to json first
2019-07-09 15:34:06 +00:00
Moritz Kiefer
2d52406199
Document damlc code layout (#2071) 2019-07-09 16:22:13 +02:00
Moritz Kiefer
13253d82d1
Turn the damlc module hierarchy into something a bit more sane (#2061)
This should hopefully be the last large reshuffling PR. I’ll write a
description of the new layout in the readme in a separate PR.
2019-07-09 15:10:40 +02:00
Shayne Fletcher
5567a5563f
Proof of concept : hlint/daml (#2050)
* Proof of concept : hlint/daml

* Copyright check is naieve

* Missing copyright

* Move hlint-testing out of compiler

fmt.sh tries to invoke hlint on the compiler directory. This then fails like,
```
2019-07-08T21:04:48.8037836Z $ hlint --git -j4
2019-07-08T21:04:48.9217137Z Couldn't find file: hlint-testing/data/HLint_QuickCheck.hs
2019-07-08T21:04:48.9277694Z UNEXPECTED HLINT FAILURE: The Bazel rules should have spotted this, please raise a GitHub issue
```

* Reformat

* This linting and formatting and so on is getting tiresome...

* Replace links with real files

* Strip the data directory

* Move files back under compiler/hlint-testing

* Copyright report_template.html so that format checks pass

* Calculate a hlint data directory path

* Whitespace and delete unneccessary file

* The format script uses this

* Use locateRunfiles

* Tweak record initialization formatting

* Reformat build file
2019-07-09 08:20:04 -04:00
Moritz Kiefer
2371d173b1
Move all damlc tests to compiler/damlc/tests (#2057)
I’ve also changed some of the names to be more sensible.
2019-07-09 13:38:58 +02:00
Moritz Kiefer
5c3620613b Fix conversion of getTag and tagToEnum# (#2055)
Previously, we unconditionally assumed that GHC will only use those on
Enum-like types, i.e., types with only nullary constructors. This
assumption turns out to be incorrect so this PR introduces additional
checks.
2019-07-09 10:47:47 +00:00
Moritz Kiefer
4f55cb3bda Fix VSCode extension and remove silly warnings (#2042) 2019-07-08 19:47:38 +00:00
Moritz Kiefer
edff8a416d
Move files in daml-foundations/daml-ghc to compiler/damlc (#2037)
* Move files in daml-foundations/daml-ghc to compiler/damlc

There is also a bit of refactoring going on to actually split things
apart into sensible targets. What is still missing is a cleanup of the
module hierarchy and a cleanup of the test targets but I’ll leave
those for separate PRs.

As a nice bonus, this also reduces dependencies between targets so it
will speed up compiles.

* Update .hie-bios
2019-07-08 17:55:51 +02:00
Moritz Kiefer
bb3a98bf61
Move code in daml-tools outside of daml-foundations (#2033) 2019-07-08 11:40:48 +02:00
Moritz Kiefer
cd69b6f553
Cache rewrites of PRSelf references (#2028)
Previously we rewrote references to `PRSelf` to `PRImport` references
every time we call `initWorld`. However, we call `initWorld` quite
often (e.g. every time we run a scenario) while the packages that need
to be rewritten stay constant. Since rewriting the package references
requires traversing the whole package, this can be quite expensive.

This PR moves the rewriting of package references out of `initWorld`
and caches it as part of `GeneratePackageMap`.

On a large project where I tested this, this caused a drop in the
runtime of `daml test` from 250s to 200s. In the IDE this can also
make a pretty big difference since we call this everytime we run a
scenario which we do on every file change.
2019-07-08 08:48:09 +02:00
Francesco Mazzoli
ca5d045e62 check that submitter is in maintainers for lookup by key (#1967)
* check that submitter is in maintainers when looking up keys

Fixes #1866. Note that this limitation applies both for `lookupByKey`
and `fetchByKey` -- anything involving retrieving a key is affected.

* add UNTIL-LF to run tests up to a certain version of DAML-LF

* name targets for DAML tests better

* add notes about DAML-LF changes

* commit Test.daml with DAML-LF 1.5 rather than compiling it on the fly

* add scenario tests for #1866

* add warnings about future key behavior in docs

* use flag rather than version when executing
2019-07-05 09:34:26 +00:00
Moritz Kiefer
ef9d27d80a Expose TcModuleResult in RuleTypes (#2014)
This should really be part of the public API.
2019-07-04 18:29:52 +00:00
Moritz Kiefer
6e14215bcc Fix some expected failures in damlc-shake-tests (#2010)
Most of them were caused by off-by-one errors in goto definition.

There was also one test that was marked as an expected failure but the
actual bug has been fixed for some time and the only reason it was
failing is that the error message was different than the test
expected.

I’ve also renamed daml-ghc-shake-test-ci to damlc-shake-tests which is
something that I might actually be able to remember :)
2019-07-04 14:57:14 +00:00
Moritz Kiefer
cf0e0d6243 Remove outdated fixme in scenario service client (#2008) 2019-07-04 13:31:26 +00:00
Moritz Kiefer
93f930f438 Fix flaky LSP stress tests (#2004)
Previously, we only checked two diagnostics messages. However, the
second diagnostics messages does not actually need to correspond to
the latest change but can just be a message that has been in the queue
from one of the 1000 changes before. Now we make sure to actually
check all (or at least every second) diagnostic.

This was technically also an issue before but since we only emitted
diagnostics when they changed and we alternate between two states it
worked fine. The way we implement debouncing means that we can now
also end up emitting two consecutive diagnostics changes for the same
set of diagnostics which made this test flaky.
2019-07-04 12:44:35 +00:00
Moritz Kiefer
bc20ace034
Make the gRPC timeout used for the scenario service configurable (#2000)
Given that we already made the max message size configurable it only
seems reasonable to also make the timeout configurable and on very
large projects, we do sometimes hit this.
2019-07-04 11:01:01 +02:00
Shayne Fletcher
96cfa3e346 Add Development.IDE.Core.Debouncer to library other-modules (#1998) 2019-07-03 19:05:54 +00:00
Moritz Kiefer
79f44e703c Implement debouncing of diagnostics (#1991)
Previously, we emitted diagnostics notifications as soon as we got
them. This resulted in a lot of flickering due to diagnostics getting
cleared briefly when typing only to immediately reappear.

Now, we buffer them for 0.1s so that a new event restoring the
same diagnostics for a slightly modified file will overwrite the
initial clear of diagnostics for the new document version.
2019-07-03 17:30:59 +00:00
Neil Mitchell
4dc9cd0020 Clean up hie-core (#1992)
* Split off addRelativeImport from modifying the session

* Switch located imports to adding their own relative imports

* Delete the unused getGhcDynFlags

* Make runGhcEnv no longer need to consult import paths

* Call runGhcEnv directly

* Move getSrcSpanInfos out to Spans

* Remove a redundant import

* Make findImports in Either rather than ExceptT

* Move getImports over to the right place

* Switch to liftEither
2019-07-03 15:38:57 +00:00
Neil Mitchell
a2ba883092 Make Haddock work for hie-core (#1990) 2019-07-03 15:21:12 +01:00
Neil Mitchell
ea3e0a863c Hide some hie-core modules (#1987)
* Hide some hie-core modules

* Make bazelifier happy
2019-07-03 13:37:13 +00:00
Neil Mitchell
ad1e8cafbf Fewer orphan instances in hie-core (#1984)
* Get rid of orphan usage in Convert

* Get rid of orphan usage in AtPoint

* Delete one entirely unused orphan

* Remove a comment that is no longer true
2019-07-03 13:01:26 +02:00
Neil Mitchell
2e45ff3c57 Standalone pieces for hie-core (#1982)
* Add a .gitignore just for the hie-core piece

* Add standalone pieces to make hie-core work with a global Cabal install

* Add more things to .gitignore, PR suggestion

* Add copyright header
2019-07-03 11:51:46 +01:00
Moritz Kiefer
330ee17be6 Make Priority in hie-core independent of DAML (#1983) 2019-07-03 10:03:16 +00:00
Moritz Kiefer
3b64291a92 Cleanup moduleImportPaths now that file paths are normalized (#1980) 2019-07-03 09:55:40 +00:00
Martin Huschenbett
3ffa2232a9 Allow shadowing of type variables in DAML and DAML-LF (#1962)
* Allow shadowing of type variables in DAML and DAML-LF

We relax the DAML-LF type checker to allow for shadowing of type variables.
This does not need big changes since the substitution we use already avoids
name capture. The test for alpha equivalence converts to de Bruijn indices
on the fly and is hence not a problem either.

We inline type synonyms during the conversion from GHC Core to DAML-LF. This
requires alpha renaming. The cheapest way to get this, is to use the unique
names of type variables instead of their surface names.

This fixes #1915.

* Fix Scala test

* Relax memory constraints for bond-trading test
2019-07-03 08:57:43 +00:00
Moritz Kiefer
995ee82fd0 Fix race condition in termination of scenario service (#1974)
Previously we sometimes ended up declaring the expected exit of the
scenario service as an unexpected exit. This PR addresses this by
adding a new variable that we set to True before we ask the scenario
service to exit by closing stdin.
2019-07-02 15:07:33 +00:00
Moritz Kiefer
c2a3d6ea28
Allow controlling the gRPC message limit via daml.yaml (#1970)
* Allow controlling the gRPC message limit via daml.yaml

We have had to raise that in the past since it caused issues on large
projects so it makes sense to make it configurable.

* Update unreleased.rst

Co-Authored-By: Beth Aitman <bethaitman@users.noreply.github.com>
2019-07-02 14:22:35 +02:00
Moritz Kiefer
b748fab0f9
Fix running the IDE on damlc (#1956)
* Fix running the IDE on damlc

There were two issues:

1. Missing include paths.
2. Files where the module name does not match the file name.

I’ve fixed both and added a test that we can load the damlc Main.hs.
2019-07-01 17:30:13 +02:00
Moritz Kiefer
af795d14ca Combine all artifacts output by damlc in .daml (#1959)
Fixes #1241
2019-07-01 15:07:30 +00:00
Andreas Herrmann
93d8e01db2
Update rules_haskell and static GHC (#1515)
* Update rules_haskell and static GHC

Remove patches that have been upstreamed or are no longer required.
Update still required patches to match the new rules_haskell version.

Previously we patched rules_haskell to coerce GHC into using static
Haskell libraries in most places. In particular we moved hs-libraries
entries into extra-libraries entries in the package configuration files.
A much cleaner approach is to compile GHC with a static RTS, then GHC
will by itself choose to load static Haskell libraries.

* Remove haskell_cc_import

* da-hs-daml-cli -> daml-cli

* da-hs-damlc-app -> damlc-app
2019-07-01 13:26:19 +02:00
Moritz Kiefer
6919b07186
Implement LSP request cancellation (#1954)
* Implement LSP request cancellation
2019-07-01 13:04:37 +02:00
Neil Mitchell
3b4c5a6597
More code actions for hie-core (#1948)
* Push the suggestion work further up

* Make LspFuncs an argument to the handlers

* Actually pass around the contents of the buffer to suggestAction

* Make suggestAction do sensible figuring out if you remove the next line too

* Better indentation

* Code action to add GHC extensions as required

* Deal with extra arguments to LSP handler
2019-07-01 08:30:37 +01:00
Andreas Herrmann
9da78116d6 Mask async exceptions in updateFileDiagnostics (#1944)
* Mask async exceptions in updateFileDiagnostics

* lsp-tests remove flaky flag
2019-07-01 07:14:31 +00:00
Shayne Fletcher
cc0e39c89e Make the README a little prettier (#1949)
* Make the README a little prettier

* Remove vscode.png

* Image float right

* Go back to regular title; scale image 75%
2019-06-28 22:14:40 +00:00
Neil Mitchell
51beadd39f
Add "Remove import" code action (#1945)
* Add a code action

* Update comments

* Remove logging, since its too verbose

* Fix a few warnings, add a final case

* Add an example of what the code action matches
2019-06-28 18:37:08 +01:00
Neil Mitchell
acffcb40e5 Fix hie.cabal (#1943)
* I put safe-exceptions in the executable, not the library

* Sort all the lines in the .cabal file
2019-06-28 15:04:00 +00:00
Neil Mitchell
dfe9c00c62
Avoid non-termination in runAction (#1938)
* Add more comments to shakeRun

* Delete the multiple versions of runActions, since they weren't used and parallel is good enough

* Delete runActionsSync entirely

* Make sure runAction returns even if shakeRun throws an exception

* Remove the callback from shakeRun - it was never used

* Fix one last use

* More comments
2019-06-28 14:56:27 +01:00
Neil Mitchell
ac4272edc5
hie-core Logging and exceptions (#1933)
* Rename reportSeriousError to reportInternalError

* Stop using logError for logging things that are warnings to the user, not errors by us

* Rename logError

* Sort the log fields properly

* Delete tagAction from Logger

* Strip down the pure logger

* Delete unused pieces of the logger

* A quick check suggests the call stack will be useful in approximately none of the callers of logging, so just remove it

* When reporting an internal error, give as much detail as we can

* Change our logger to be based on Priority values

* HLint fixes

* Rename makeNopLogger

* In hie-core say what level of message you are setting

* Delete the unused makeOneLogger

* Make sure we can show messages floating around

* If a notification/response handler throws an exception, report it upwards

* Remove reportInternalError in favour of a general logging mechanism

* Add missing dependencies

* Just call fail for a dodgy error report

* Add a FIXME

* Make missing modules just an error
2019-06-28 12:47:45 +01:00
Gary Verhaegen
6320954893 delete dead code, fix typos in comments (#1923) 2019-06-28 07:14:52 +01:00
Neil Mitchell
e75d2b465e Make CPP work better with hie-core (#1903)
* Pull the CPP into a separate module

* Pass Nothing to indicate that a text buffer shoud just be used from disk

* Add save handlers, since the version changing to ModTime may have an impact

* Rename contents to mbContents in one place

* Change runCpp to take a Maybe StringBuffer and attempt to reuse the existing file, if it can

* Add a Bazel alias for hie-core

* Add notes about the sad path

* Avoid one use of filePathToUri

* Avoid another use of filePathToUri which went wrong for CPP output

* Normalize Uri's by replacing adjacent // with a single /

* Improve how CPP works if you have a modified buffer

* Move textToStringBuffer out to Util

* Switch to hPutStringBuffer which is in GHC 8.8

* Note why we are escaping to /

* Refactoring suggested by review
2019-06-27 22:17:37 +00:00
Remy
fe33450fa5 damlc: fix serializability of empty enum (#1893) 2019-06-26 17:16:16 +00:00
Neil Mitchell
8db9941858
Make hie-core outside an IDE work better (#1895)
* Move the hie-core demo files around (they aren't really a demo anymore)

* Split the command line parsing into a separate module

* Give messages about how long starting something takes

* Make the interactive mode say what it is doing a bit more

* Add a --cwd flag to hie-core

* Take a list of files and directories for hie-core

* Update the readme to say how to test using hie-core

* Fix up the bazel file

* Add HLint exception
2019-06-26 17:07:08 +01:00
Martin Huschenbett
9b0399d5d9 Drop support for DAML-LF 1.4 from damlc (#1888)
* Drop support for DAML-LF 1.4 from damlc

This is part of #853.

* Remove exerciseWithActors and archiveWithActors
2019-06-26 15:15:22 +00:00
Moritz Kiefer
7725d25a41
Mark lsp-tests as flaky (#1891) 2019-06-26 14:05:12 +02:00
Neil Mitchell
b01464339c
Delete bits of hie-core that were unused (#1885)
* Delete now unused code

* Make protocol not reexport LSP.Types

* Delete more comments

* HLint
2019-06-26 12:15:16 +01:00
Stephen Compall
9bcc925a40
intern package IDs in LF (#1614)
* specify the new fields for interning package IDs

* percolating intern tables

* crawl packages for package IDs as a pre-phase: generic prep

* stub case for interned_id in Scala packageref reader

* HasPackageRefs instances for the rest of the ast

* make intern table and use when encoding PackageRefs in v1

* don't need where

* stub out decode for interned package IDs

* no benefit to using uint32 instead of uint64

* percolate in encode one step

* interned case for decoding PackageRefs

* naming details

* intern table decoder

* finish propagating the intern table in encoder

* encode the package ID table

* document the vital assumption of encodeInternedPackageIds

* propagate the intern table through the LF decoder

- done by stacking ReaderT on top of Decode internally,
  as discussed with @hurryabit

* daml-lf-proto requires mtl

* stub out interned case in Scala LF decoder

* stub interface decoder function

* get the interned table to most places in InterfaceReader

* support for interned package IDs in Scala decoder

* use ImmArraySeq instead of Vector for Scala intern decode table

* adding that ghc extension didn't make sense

* implement interned ID decoding for InterfaceReader

* scenario service won't have interned package IDs

* test the interned ID resolution in Scala by examining the proto -> AST in detail

* proper precondition for the dev phase of interned IDs testing

* better error reporting for malformed DALFs in intern test

* just import Data.Int

- suggested by @neil-da; thanks

* pass around the lookup function instead of the vector in decoder

- suggested by @neil-da; thanks

* remove derivations for types deleted in e63b012d2d

* rename VersionAware to EncodeCtx

- suggested by @hurryabit; thanks

* rename MDecode to MonadDecode

- suggested by @hurryabit; thanks

* pass a function through the encoder instead of a set

- based on suggestions by @hurryabit and @neil-da; thanks

* daml-ghc test that interned IDs are generated

- suggested by @hurryabit; thanks

* adapt to 5b480c99ec #1844
2019-06-26 11:15:24 +02:00
Neil Mitchell
1a1d1591af
Make the hie-core server retargetable (#1873)
* Move mergeHandlers into Server

* Make partial handlers a proper newtype

* Pass the options in to runLanguageServer

* Take in user handlers

* Remove the code lens handler since we don't advertise it

* Add setSomethingModified, rather than faking it for the LSP VFS

* Rewrite the LSP notifications

* Improve the display of info messages around openning and modifying text documents

* Make sure stdout and stderr don't have buffering, so we see their output immediately

* Handle exit properly

* Make notifications forward on to their previous values

* Remove the exit handler, HIE already has a good default for it

* Add comments on FileStore
2019-06-26 09:04:10 +01:00
Neil Mitchell
409eba0aab Correct hie-core grammar (#1871) 2019-06-25 19:24:56 +00:00
Martin Huschenbett
a5cf162b2a Remove two obsolete error messages from before complex contract keys (#1870) 2019-06-25 20:06:35 +01:00
Neil Mitchell
c6ba459709
Give the readme a significant pass (#1869) 2019-06-25 19:07:00 +01:00
Robin Krom
05d80eeeb4
language: upgrades: no generics for data types having the instances already (#1840)
language: upgrades: dont derive generics for data types having the instances already

We only derive generic instances on the fly for data types that don't
have them already.
2019-06-25 18:17:34 +02:00
Neil Mitchell
c8adb9810d Significantly alter the hie-core LanguageServer (#1862)
* Inline chunks of LSP.Server into LanguageServer

* Inline runServer

* Start figuring out a better API for gotoDefinition

* Remove old JIRA ticket numbers

* Add a hover handler in the new form

* Change the new handlers slightly

* Add a new module to handle notifications updating the virtual file system

* Rewrite the language server in hie-core to use the Handler more directly

* Add a cancel handler

* Ignore a few more handlers

* HLint

* REname functions that set handlers

* Rename a few more set handlers

* Delete the unused makeResponse

* Move mergeHandlers over to LanguageServer

* Rename RunHandler to WithMessage

* Switch from STM to IO

* Avoid the Protocol module

* Rename AddItem to Message

* Document why we use clientMsgChan

* Add comments around Message
2019-06-25 15:13:17 +00:00
Martin Huschenbett
25f1369cd7 Add support for DAML-LF's enum types to damlc (#1824)
* Add support for DAML-LF's enum types to damlc

This is part of #105.

* Address feedback
2019-06-25 14:44:21 +00:00
Moritz Kiefer
98e91d2ca2
Handle early exits of the scenario service (#1858)
fixes #1772
2019-06-25 15:34:02 +02:00
Martin Huschenbett
19b2d5c86c Rename none and some to optional_none and optional_some in DAML-LF (#1810)
This fixes #95.
2019-06-25 12:47:38 +00:00
Neil Mitchell
0fcbbf489e Delete unused deps (#1856)
* Delete unused package dependencies

* Eliminate the use of pretty

* Don't export some things that weren't necessary

* Add a missing dependency

* Avoid reexporting files of interest methods

* Put toIdeResult back
2019-06-25 09:09:42 +00:00
Stephen Compall
5b480c99ec
Decode modules abstractely in scenario-service server (#1844)
* add scenario Module decoding to Decode.OfPackage

* use purely data-driven decoding in scenario service in Scala

- decouples scenario service from LF decoder implementation

* make DecodeV1 companion private

* make extension to LFv2 more obvious
2019-06-25 09:49:04 +02:00
Neil Mitchell
95176a4f2b
Don't import LSP.Protocol (#1853) 2019-06-24 18:48:28 +01:00
Moritz Kiefer
1406c41c02
Use 127.0.0.1 instead of localhost to connect to scenario service (#1848)
This fixes issues when running in an Alpine Linux docker container.
2019-06-24 16:45:12 +02:00
Moritz Kiefer
5a951120b6
Support goto definition on types in type annotations and type signatures (#1845) 2019-06-24 14:49:36 +02:00
Neil Mitchell
ee3b62c380
Clean up the logging in hie-core (#1839)
* Move prettyPosition over to a more sensible place

* Avoid some pretty printing

* Remove duplicate methods and switch to having a function to get the logger handle

* Remove unncessary bits of the logger

* Remove reportSeriousErrorDie - was unused

* Rename the Logger methods to Logger rather than Handle

* Delete the unique supply

* Decrease the use of getServiceEnv

* Move getIdeOptions inside Service

* Add getFilesOfInterest rule

* Hide the existence of Env

* Inline some redundant forwarding methods

* Add a FIXME for a dodgy function

* Delete some redundant imports

* Rename Map to HMap, since I need to use Data.Map too

* Make the Shake-specific Diagnostics functions into that module

* Delete errorDiag which was unused

* Inline the diagnostic function, since it had one user

* Add ofInterest rule as a separate module

* Sort the exposed modules

* Fix up the demo

* Make sure you add the OfInterestVar global

* HLint

* Get rid of some of interest stuff in other places

* Remove the OfInterest stuff from Service
2019-06-24 12:46:51 +01:00
Moritz Kiefer
d828956de2 Fix cross package goto definition (#1834)
The reason for why it was broken was rather simple: We just lost the
non-compat logic somewhere along the way.

fixes #1582
2019-06-24 09:18:26 +00:00
Neil Mitchell
0b396be07a
Make hie-core Compile simpler (#1832)
* Delete LoadPackageResult, was unused

* Delete tmrOccEnvName from Compile

* Push orphan instances around a bit, avoiding some

* Make convertModule take an explicit filename to report against (since we have a good one in our hands)

* Get rid of GhcModule - only one field was ever used

* Collapse setVritualFileContents and removeVirtualFile into one

* Make the VFSHandle abstract

* Make it clear runGhcSession does not need IdeOptions

* Avoid passing around IdeOptions so much when they aren't required

* Get rid of runGhcSessionExcept

* Make catchSrcErrors be in Either, not ExceptT

* Don't import ExceptT qualified

* Don't import Exception qualified

* Rewrite and simplify computePackageDeps
2019-06-24 08:46:16 +01:00
Neil Mitchell
282f8b4432 Delete prettyprinter-syntax (#1829)
* Delete the entirely unused reflow function

* Don't have Data.Text.Prettyprint.Doc.Syntax reexport stuff

* Move most of the pretty printing inside hie-core

* Get rid of the prettyprinter-syntax dependency from hie-core

* Get rid of prettyprinter-syntax, by collapsing the one definition into DA.Pretty
2019-06-24 08:00:42 +01:00
Shayne Fletcher
01a2de023d
Integrate Emacs instructions into README (#1831)
* Integrate Emacs instructions into README

* Fix a grammatical error
2019-06-23 17:59:53 -04:00
Neil Mitchell
023704cb67 Add additional step of building the hie-core extension (#1827) 2019-06-23 21:59:38 +00:00
Shayne Fletcher
c8e7af5fd8
Update the hie-bios commit SHA (#1825)
* Update the hie-bios commit SHA

* Also update the SHA in our bazel WORKSPACE

* Update the hash too

* Tutorial for Emacs integration

* Update hie-bios patch
2019-06-22 12:01:44 -04:00
Martin Huschenbett
e63b012d2d
Inline the EnumType and EnumCon types in Haskell's DAML-LF AST (#1822)
My primary goal is to avoid confusion when starting to support DAML-LF's
enum types. I also think these types were never particularly useful,
although I introduced them myself...
2019-06-22 12:01:56 +02:00
Neil Mitchell
8885160c7c Further cleanups to hie-core (#1819)
* Move the span related functionality to one place

* Fuse docHeaders away

* Decouple AtPoint from the rest of the rule database, simplifying the dependencies

* Move the import related functionality to one place

* Move all the closely tied to GHC modules together

* Rename the Logger module

* Push the other module renames through the code base

* Rename Development.IDE.State to Development.IDE.Core

* Rename Functions.Compile to Core.Compile

* Fix up some module names

* Cut down on non-sensicle exports

* Don't worry about setting source - no one uses it

* Reorder the module header

* Give more sensible names to the diagnostic creating functions

* Use more appropriate diagnostic functions

* Simplify the internal diagnostic creations

* Rewrite the diagnostics to go direct, not via GHC error types

* Remove redundant dflags from some functions

* Make sure the warning vs error distinction remains

* Remove unnecessary extensions
2019-06-22 09:21:59 +01:00
Neil Mitchell
39e27fb2e3 Clean up hie-core (#1815)
* Make atPoint generate either haskell or daml syntax, depending on options

* Get rid of data HoverText

* Move VirtualResource out from hie-core

* Rename hie-core to the right name

* Drop Types.LSP, merge it into LSP.Protocol

* Remove orphans that aren't actually used in our code

* Delete redundant newlines

* Add a defaultIdeOptions function

* Move ideTryIOException over to its one user

* Delete unused exports

* Delete the ProjectDiagnostic newtype - the type index was always Key

* Don't reexport position information from Diagnostic

* Delete the unused bits from Location

* Delete unused stuff from getSrcSpan

* Move URL stuff into Location from Diagnostic

* Remove unnecessary CPP

* Remove unnecessary extension

* Change from stage being polymorphic to being a Text

* Fix up the test suite too

* Push the cleanup to the edges

* More dependencies

* Patch up the tests now they need to find the type signature inside a ```daml block
2019-06-21 21:19:07 +00:00
Neil Mitchell
3e1083e1fe Rename haskell-ide-core to hie-core (#1809)
* Rename haskell-ide-core as hie-core, after discussions with Alan Zimmerman and others

* Update the readme to just say how to install
2019-06-21 17:07:09 +00:00
Moritz Kiefer
c5cce0b22c [hs-ledger-bindings tests] Read the main dalf from the DAR manifest (#1803)
Previously, we got the package id by listing all packages and taking
the first. That is not a valid assumption and broke with a PR. This PR
changes the tests to use the DAR reader that we already used for
visualization (now factored into a separate library) and reads the
main dalf using that.
2019-06-21 15:32:40 +00:00
Moritz Kiefer
aac3c7b012 Support goto definition on symbols in the module export list (#1801) 2019-06-21 14:07:59 +00:00
Andreas Herrmann
b438c2ad82 Move LSP stress tests to lsp-tests (#1799)
* Move IDE stress test to lsp-tests

* Lower timeout.

The test case takes < 3 seconds on my machine. The 180 seconds timeout
seems far too much.

* Data.Text.Extended -> Data.Text
2019-06-21 14:02:39 +00:00
Moritz Kiefer
67f1468f14 Clean up the Handle module (#1793)
Handle is kind of a mess at the moment, this is a first step towards
cleaning it up:

1. We had two functions called getDalfDependencies with one wrapping
the other. This PR merges them into one to make this less confusing.

2. buildDar called runAction a bunch of times directly and via other
functions. This PR switches it to use a single call to runAction.

3. The logic for turning a Maybe into an `ExceptT [FileDiagnostic]`
was duplicated in various places. This PR factor out the logic into a
single function.

There is certainly more cleanup to be done (e.g., I don’t think
ExceptT buys us anything here, that module should probably die
completely with the logic being moved to other modules, …) but I’d
like to do it incrementally.
2019-06-21 09:53:20 +00:00
Moritz Kiefer
5991fbcee8
Use BadDependency consistently (#1787)
Previously we had a weird mix of using ExceptT to shortcircuit on
failed dependencies where the list of diagnostics was always empty and
throwing BadDependency exceptions.

This PR switches everything over to use BadDependency for failed
dependencies and removes a lot of conversions from one style to the
other.
2019-06-21 09:27:40 +02:00
Martin Huschenbett
ca3ca745fb
Rename DAML-LF primitives for conversion between Text and code points (#1777)
I find the current names very confusing and unintuitive.

I'm aware that there are other primitives called `TO_TEXT_X`. But there the
`X` is meant to be a type index to `TO_TEXT`. This doesn't make much sense in
the context of `TO_TEXT_CODE_POINTS` though since there's no type named
`CodePoints`.
2019-06-20 16:03:11 +02:00
Moritz Kiefer
3a1a469453
Mark lsp-tests as flaky on Windows (#1782) 2019-06-20 15:49:35 +02:00
Moritz Kiefer
b41775e4d8
Move webview src to a separate JS file (#1784)
This makes it easier to modify and @hurryabit can no longer claim to
review Haskell when I change JS ;)
2019-06-20 14:55:30 +02:00
Moritz Kiefer
647c4d539e
Preserve the selected view on scenario result updates (#1776)
Previously, we always reverted back to the table view when the
scenario results changed. This PR changes this to preserve the
selected view.

I’ve also tested that this does not break backwards compatibility: If
you use the newer extension with an older SDK, you will get the
previous behavior of reverting to the table view and you can still
switch by clicking on the button.

Fixes #1675
2019-06-20 13:03:14 +02:00
DavidM-D
e4d6f7b0c3
Hic elisp (#1714)
* Added elisp to the readme

* Changed the flags for compatibility with HIE

* Change the default arguments to reflect hie compat
2019-06-18 14:10:52 +02:00
Moritz Kiefer
24722617c4
Make runActions return Return as soon as results are available (#1736)
* Make runActions return Return as soon as results are available

Previously, we were waiting for all rules to finish, in particular the
ofInterestRule. That doesn’t really make any sense, e.g., a goto
definition request should not be waiting for all scenarios to run.

The next step will be to change the LSP side such that requests and
notifications are processed in parallel where possible.
2019-06-18 14:08:13 +02:00
Robin Krom
ca163d708e
language: feature: initial implementation of a 'migrate' command (#1707)
* language: feature: initial implementation of a 'migrate' command

We add a 'migrate' command to daml assistant that generates a project
that allows to migrate contract instances from package1 to package2.
This first version reads both package1 and package2 from source. As a
next step we read only the dalfs from package1, because it might have
been created with a different compiler.
2019-06-17 16:40:08 +02:00
Andreas Herrmann
9990486bb1 Load core-package dependencies in da-ghci (#1712)
* Fix #1656

* da-ghcid extra arguments

* Fix formatting
2019-06-17 12:56:33 +00:00
Neil Mitchell
b6a745b412 Don't pass the same argument twice (#1708) 2019-06-17 12:20:51 +00:00
Neil Mitchell
72f8e3e5a6 Fix up the CPP flags that are defined (#1694) 2019-06-17 13:10:15 +02:00
Moritz Kiefer
3636bc7846
Double gRPC limit in the scenario service (#1697)
This is a temporary fix to unblock users that have run into this
limit. The long-term solution here is to use compression and/or make
the limit configurable.
2019-06-17 09:55:27 +02:00
Gary Verhaegen
40d9ae284e Update README.md (#1690) 2019-06-15 21:16:16 +02:00
Neil Mitchell
8cd7bde9d4
Don't error on goto definition for another package (#1687) 2019-06-15 16:11:20 +02:00
Neil Mitchell
95917c7603 Describe how to install the IDE (#1686)
* Add more package.json attributes

* Rename ide-demo to haskell-ide-core

* Change the default flags for the IDE

* Update the README with how to install things
2019-06-15 13:23:59 +02:00
Moritz Kiefer
c8f9a91a8e
Initial stab at integrating hie-bios (#1685) 2019-06-15 10:29:40 +02:00
Neil Mitchell
594a61aa72
Add IDE Readme (#1678)
* Add .vscode settings that are useful for making it easier to build

* Ignore the extension output

* Add a README that describes how to start the IDE
2019-06-14 18:10:13 +02:00
Neil Mitchell
4e1a6809df Add CodeLens support to the fake LanguageServer (#1673) 2019-06-14 15:24:24 +00:00
DavidM-D
7a0208932f Initial commit of bare bones haskell extension (#1674)
* Initial commit of bare bones haskell extension

* Removed dummy tests

* Added highlighting extension as dependency

* Added copyright header
2019-06-14 15:12:56 +00:00
Neil Mitchell
599b9e97ab Move the ofInterest kicking around in the IDE (#1669)
* Move getFilesOfInterest into the IDE, and OfInterest out into DAML

* Have the IDE mode kick all active files each time

* Add a missing .cabal dependency

* Add a missing dependencies

* Use the right thing, if any files have parse errors, then don't worry

* Print messages to stderr rather than stdout

* Add a big warning that writing to stdout is a bad plan
2019-06-14 14:23:22 +00:00
Nicholas Clarke
50e02df051 Add: Support building in nix-shell. (#1670)
Can now run the demo script inside a nix-shell which provides a GHC libdir.
2019-06-14 16:11:32 +02:00
Neil Mitchell
dfc1c48f4d
Add --ide flag (#1668)
* Add --ide flag to the Demo

* Fix things in the .cabal file

* Add tracing messages to Demo.hs
2019-06-14 14:26:25 +02:00
Neil Mitchell
df79a0c403 Move LanguageServer into haskell-ide-core (#1665)
* Move Definition and Hover over to IDE.LSP

* Copy LanguageServer over to IDE Core, not ideal, but hard to abstract right now

* Warn that there are two copies of a given module

* Move printing out the SDK version out of language-server
2019-06-14 09:02:04 +00:00
Neil Mitchell
d94d46d341 Update to use LSP from github (#1662)
* Update to use LSP from github

* Switch to upstream LSP everywhere
2019-06-14 08:38:29 +00:00
Neil Mitchell
022f3b3380 Update haskell-ide-core.cabal (#1659) 2019-06-14 01:12:34 +02:00
Neil Mitchell
c1378b329c
Change the IDE demo to use runLanguageServer (#1655) 2019-06-13 18:21:27 +02:00
Neil Mitchell
1a55df1abc
Inline da-hs-language-server into haskell-ide-core (#1652)
* Inline da-hs-language-server into haskell-ide-core

* Fix up the bazel file for new dependencies
2019-06-13 18:03:26 +02:00
Moritz Kiefer
304a049768 Remove one level of tracking files of interest and open VRs (#1650)
Previously we tracked this both at the Shake level and at the LSP
level which doesn’t make any sense. This PR removes the outer LSP
layer.
2019-06-13 15:14:34 +00:00
Moritz Kiefer
ea72a1bc03 Unflake import cycle tests (#1647)
For a cyclic import we actually have to write the files to disks,
otherwise we can end up with an error about the module not existing if
we check imports before the other module has been added to the VFS.
2019-06-13 14:27:38 +00:00
Moritz Kiefer
c5a1212ecc Remove the dependency of da-hs-language-server and language-server on da-hs-base (#1642) 2019-06-13 13:48:25 +00:00
Moritz Kiefer
be63c39d0d
Introduce a newtype for file paths with normalized slashes (#1633)
This implements part 2 of #1507 and fixes the daml-ghc-test-dev test
suite on Windows (not enabled on CI due to GRPC issues).

I have also tested this in the IDE on Windows and Linux.
2019-06-13 15:11:47 +02:00
Remy
0591075187 cleanup daml-lf scala packages (#1581)
* cleanup daml-lf scala packages

* Address Stephen's Comments

* update maven coordinates of language package
2019-06-12 15:55:48 +00:00
Moritz Kiefer
be974260ce
Normalize percent-encoding in URIs (#1603)
This implements step 1. from #1507 and also adds a test that uses an
insane percent-encoding to verify that we can handle that.

I also tested this in the IDE on Windows and Linux.
2019-06-12 15:20:23 +02:00
Martin Huschenbett
99adde7a5e Remove useless version paramater from LF.World.initSelfWorld (#1601)
That parameter should have never been there in the first place since it is
completely useless.
2019-06-12 11:55:27 +00:00
Moritz Kiefer
8029080fc7
Use FromServerMessage directly (#1583)
Previously we had two layers of indirection:

In the compiler we emitted Event, we then translated this to
ClientNotification which was then translated to
FromServerMessage.

Apart from being confusing and convoluted this also resulted in us
doing the conversion to generic LSP types too late so we had scenario
specific code in places where it shouldn’t be.

This PR removes the indirection and just uses FromServerMessage
directly.
2019-06-11 16:03:44 +02:00
Shayne Fletcher
da88ab0f9d
Up-(actually down-)grade to ghc-lib-8.8.0.20190610 (#1576)
* Up-(actually down-)grade to ghc-lib-8.8.0.20190610

* A `#ifndef GHC_STABLE` removed. `ml_hie_file` must be set unconditionally

* Pass Opt_WriteHie in xFlagsSet

* Oops. Revert. This breaks Windows. Very confusing

* Disable test; track in issue https://github.com/digital-asset/daml/issues/1582

* Remove Opt_WriteHie flag (Causes test failures trying to write into a read-only filesystem in CI)
2019-06-11 08:58:16 -04:00
Moritz Kiefer
d9f266a4d4 Remove EventFileValidation (#1579)
We never actually emit this event so it’s pretty much useless. If we
do want to add progress reporting at some point, we should go with the
recently added official support for that in LSP
https://github.com/Microsoft/language-server-protocol/issues/70#issuecomment-483252666.
2019-06-11 09:15:12 +00:00
Moritz Kiefer
d3b33d7c11
Port the remaining tests from language-server-tests to lsp-tests (#1563) 2019-06-08 08:36:27 +02:00
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