Commit Graph

369 Commits

Author SHA1 Message Date
Moritz Kiefer
9ce0d414c4
Force values in setValues and getValues (#2494)
Otherwise, we can end up retaining references to the old map which
prevent it from being garbage collected.

On a simple testcase that repeatedly opens and closes a module, this
seems to make memory usage constant whereas it was increasing
each time before.
2019-08-12 17:40:12 +02:00
associahedron
ed0d5667c2 damldocs: Small type rendering improvements. (#2492)
* Add parentheses around type operators in expressions.

* Remove levity arguments from (->) in stdlib docs

* Avoid parenthesizing type-level literals
2019-08-12 15:28:57 +00:00
Robin Krom
829cb4cef5
Daml stdlib with versions (#2479)
* language: build daml_stdlib with a version in the package name.

* versioned daml-stdlib in damlc

* reformat bazel files

* fix daml_doc_test
2019-08-12 16:05:28 +02:00
associahedron
b16f937d7e damldocs: Show relevant instances for types and classes. (#2487)
* Add md_instances field to ModuleDoc

* Extract instances

* Add instance fields to class and type docs.

* Implement distributeInstanceDocs

* Use Maybe list instead of list.

* Render instance docs.

* Add instance data in tests and add a golden test.

* Rename to orphan typeclass instances.
2019-08-12 13:48:46 +00:00
Martin Huschenbett
bbfa0a1318 Simplify test for issue with GHC.Tuple.Unit (#2475)
* Simplify test for issue with GHC.Tuple.Unit

* Make sure tests actually produces GHC.Tuple.Unit somewhere
2019-08-12 09:20:40 +00:00
Rohan Jacob-Rao
c2f315d2ba
Support generic templates (#2465)
* Upgrade ghc-libs supporting generic templates
* Update Proposal and ComposedKey tests to generic template syntax
* Temporarily patch daml-doc test output (will need to fix for template instances)
2019-08-09 17:15:51 -04:00
Moritz Kiefer
2b690fd420 Increase timeout on lsp-tests (#2478)
Now that they are no longer marked as flaky on Windows, we seem to be
hitting the actual Bazel timeout sometimes.
2019-08-09 15:32:32 +00:00
associahedron
2262c5add0
damldocs: Show only exported things. (#2477)
* Add exports to doc ctx

* Filter out unexported things.

* Added a golden test

* Fix missing constructors.

* Hide unexported class members

* Add rst golden test as well

* Remove unnecessary HIDEs from stdlib.

* lint
2019-08-09 16:12:47 +01:00
Moritz Kiefer
d388c5692b
Upgrade haskell-lsp and lsp-test (#2474)
* Upgrade haskell-lsp and lsp-test

There have been some fixes upstream that should hopefully mean that we
no longer need to mark the lsp-tests as flaky on Windows. I am having
trouble reproducing the flakiness locally, so let’s see what happens
on CI.

* Also bump stack.yaml
2019-08-09 15:09:59 +02:00
Martin Huschenbett
3c03d8c33b Simplify how we compute the label of a data constructor (#2473)
Currently, we pass the flavour of the type constructor around although that
is cheaply computable from the data constructor itself. Thus, don't pass the
flavour around.
2019-08-09 11:39:58 +00:00
Moritz Kiefer
491d13a276
Add an ide-debug-driver to make it easier to find leaks (#2472) 2019-08-09 12:48:05 +02:00
Martin Huschenbett
e9e96be3da Avoid one indirection when constructing enum values (#2469)
For every enum constructor `Foo` we produce a function `$ctor:Foo` whose
value is simply `Foo`. When we convert `Foo` to DAML-LF, we convert to
a call of `$ctor:Foo`. Since enum constructors are always fully applied,
this indirection is useless. Thus, we remove it in this PR.
2019-08-09 09:01:36 +00:00
Martin Huschenbett
9b1d5c8c32 Avoid duplicate record constructors (#2466)
GHC produces a function `$WFoo` for every record data constructor `Foo`.
The conversion to DAML-LF produces a function `$ctor:Foo` which does exactly
the same. We stop doing this and use the `$WFoo` function instead. Since GHC
does not produce `$WFoo` for newtypes, we need to produce these nevertheless.

I'll leave solving the corresponding issue for variant types to another PR.
2019-08-09 07:24:20 +00:00
Martin Huschenbett
53de4511ce Make DAML internal functions version independent (#2464)
Right now, the set of internal functions seems to depend on the DAML-LF
version although it actually doesn't. Since GHC is smart enough this doesn't
bite us but doesn't feel particularly clean either. If the internal functions
ever start to depend on the DAML-LF version again, we should probably put
them into the environment of the conversion to DAML-LF.
2019-08-08 18:32:10 +00:00
Martin Huschenbett
f357b2f0b7 Remove compiler code to inject DAML-LF primitives for old desugaring (#2462)
The code removed was responsible for injecting DAML-LF primitives for
`create`, `exercise`, etc. for the old template desugaring. These code
paths are not hit anymore with the new template desugaring.
2019-08-08 18:04:15 +00:00
Moritz Kiefer
bdd665fcf8
Only change project root once (#2459)
* Only change project root once

As described in #2449, calling withProjectRoot' twice breaks with
relative paths and is also just silly so this PR fixes this by
factoring out the actual logic from init from execInit which does the
project root thingy.

* Add a regression test
2019-08-08 19:56:04 +02:00
Martin Huschenbett
8fc5b62bd8
Avoid one indirection for dictionary construction (#2456)
* Avoid one indirection for dictionary construction

For every constructor `Foo` we generate a function `$ctor:Foo` which calls
the DAML-LF constructor for `Foo`. This function is useless since GHC already
creates a function `$WFoo` for us which does the same. This PR remove the
`$ctor:...` functions for type class dictionaries.

This makes a bit of a mess in the `Ctors` data type. This will be cleaned up
when all `$ctor:...` functions are finally gone.

* Fix construction of XInstance templates
2019-08-08 19:12:44 +02:00
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