Commit Graph

552 Commits

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

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

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

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

* Unpin a few DAML-LF target versions in tests

* Fix golden tests

* Adapt changelog to rebase

* Rename DAML-LF scenario tests to 1.dev

* Update tests to --target 1.dev

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

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

* Listen up Wally, Remove redundant commented code!

* Argh! WhattamistakeAtomakeA!

* Whitespace to force Azure pipeline to reconsider ignoring this PR

* Repackage ghc-lib, update SHAs and push again

* Refer to a non-existent release as an experiment

* Put the release number back

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

* Address Francesco's comments

* Address Martin's comments

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

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

This fixes #1398.

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

In other words, we release DAML-LF 1.5.

This is required for generic templates (#1387).

* description of FROM_TEXT_INT64 & FROM_TEXT_DECIMAL

* amend version history

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

* typos

* Fix markup in DAML-LF spec

* Add release notes
2019-05-27 21:11:37 +00:00
Remy
439613bee8 daml-lf: add FROM_TEXT_INT64 and FROM_TEXT_DECIMAL (#1407)
* daml-lf: add FROM_TEXT_INT64 and FROM_TEXT_DECIMAL

* Fix typos in Haskell

* cosmetic change

* Fix DAML-LF type checker

* Fix merging fallout
2019-05-27 17:19:01 +00:00
Martin Huschenbett
34d436d77d Drop support for DAML-LF 1.1 from damlc (#1231)
* Drop support for DAML-LF 1.1 from damlc

Part of #853.

* Fix docs test

* Add show party test back

* Update release notes

* Remove target version from Java codegen test
2019-05-27 16:07:35 +00:00
Martin Huschenbett
c30ec0fc03
Make the actors optional in DAML-LF's exercise instruction (#1377)
* Make the actors optional in DAML-LF's exercise instruction

If they are not present, the controllers will be filled in. Surface DAML
does this currenty anyway by fetching the contract and computing the
choice controllers before each `exercise`. This change will allow for
getting rid of the additional `fetch` preceding each `exercise`.

The compiler does not use the new form yet. I will do this in a separate
PR together with tests for the new behaviour.

This fixes #1347.

* Fix DAML-LF type checker test

* Check presence of actors for old DAML-LF versions in decoder
2019-05-24 15:01:56 +02:00
Remy
4f18b1afa7 DAML-LF internal type safety (#1192)
* Rename Value's ContractId to VContractId

* daml-lf: a bit more about PartyId

* daml-lf: Concatenable MatchingStringModule

* daml-lf make clear type used for Scenarios only

* daml-lf create ContractId, LedgerId, TransactionId

* sandbox-sql conversion util

* LedgerName -> LedgerString

* futher type cleanup in the sandbox

* daml-lf add test for LedgerString

* fixing tests

* a bit more safety in the DB

* Address Stephen's comments

* fix rebase

* More fixes for StringModule

* change length of LedgerString (256 -> 255)
2019-05-24 09:53:29 +00:00
Martin Huschenbett
b09cbd037b
Add coerce for contract ids to DAML-LF (#1346)
* Add coerce for contract ids to DAML-LF

This is needed for our implementation plan for generic templates.

Fixes #1277.

* Reformat Scala
2019-05-24 09:08:15 +02:00
Moritz Kiefer
1c580d84a5
Make exposed-modules field in daml.yaml optional (#1345)
If unspecified, we expose all modules in the project.

Fixes #1328
2019-05-23 15:37:37 +02:00
Martin Huschenbett
8ec03875c6
Lift restriction on serializable contract ids in DAML-LF 1.dev (#1315)
* Lift restriction on serializable contract ids in DAML-LF 1.dev

In DAML-LF 1.dev, make `ContractId a` serializable whenever `a` is
serializable. This is part 2 of #1277.

* Reformat Scala

* Add changelog entry to daml_lf_1.proto
2019-05-22 22:23:59 +02:00
Martin Huschenbett
71d918e4f5 Remove use of Coercible from EncodeV1/DecodeV1 (#1305)
This is another cleanup after removing the `Tagged` anti-pattern.
2019-05-22 14:58:43 +00:00
Moritz Kiefer
4f0734c9f3 Fix an issue in module chasing caused by unnormalized file paths (#1303)
On Windows we can end up with rootModDir having / in the filepath
while rootPathDir uses \ so stripSuffix didn’t work.

This fixes #1284
2019-05-22 11:58:22 +00:00
Martin Huschenbett
6e73868220 Replace all occurrences of Tagged in DAML-LF AST with newtypes (#1289)
* Replace all occurrences of Tagged in DAML-LF AST with newtypes

This must end as it makes the code bases harder to understand without
adding any benefits.

* Add two more usages of mkVal

* Remove Orphans.Lib_hashable

* Remove tagged from package dependencies

* Derive stock classes as such
2019-05-21 16:19:57 +00:00
Martin Huschenbett
ee02c9ee6e Make DAML-LF 1.4 the default version output by damlc (#1283)
* Make DAML-LF 1.4 the default version output by damlc

This removes the syntactic restriction on contract keys.

* Add DAML-LF 1.4 to release notes
2019-05-21 14:33:44 +00:00
Francesco Mazzoli
95e8dd01c7 Maintainers must be signatories (#1124)
* check that maintainers are a subset of signatories

fixes #1123

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

* Fix all warnings in the Demo file

* Build the IDE demo

* Give a better error message than undefined

* HLint

* Fix copyright header

* Sort the dependencies

* Improve the comment

* Bazel formatting

* Disable building on Windows until ghc-paths is fixed

* Bazel formatting

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

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

* Move the optMbPackageName out to daml-ghc

* Make sure we clean up all temporary files

* Clean up the import list

* Move runGhcFast to its one use site
2019-05-20 12:05:21 +01:00
Martin Huschenbett
24e305c1af Relax syntactic restriction on contract keys in DAML-LF 1.dev (#1219)
* Relax syntactic restriction on contract keys in DAML-LF 1.dev

We lift the syntactic restriction that contact keys must be built using
only record constructions and projections entirely when compiling to
DAML-LF 1.dev. To make this more useful, we also search all sub-expressions
of `maintainer` in `key` during our rewriting of `maintainer` for using
`this` to using `key`.

As one of our next steps we should bring `key` into scope in `maintainer`
and perhaps deprecate the use of `this` at some point in the future.

* Fix versioning

* Adapt package validation to complext contract keys
2019-05-17 20:06:23 +00:00
Martin Huschenbett
ed66eb4cf6
Refactoring: Replace Encode type class with monomorphic functions (#1228)
* Refactoring: Replace Encode type class with monomorphic functions

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

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

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

* Update compiler/haskell-ide-core/src/Development/IDE/Functions/Compile.hs
2019-05-16 15:14:08 +01:00
Martin Huschenbett
02d61cc48f
Rename render/parse functions for DAML-LF minor versions in Haskell (#1182)
The current naming suggests, the protobuf encoding and the CLI use different
textual representations of minor versions, which is not true. They only
differ in their types. We push this type conversion to the call sites
of both functions instead.
2019-05-16 14:58:10 +02:00
Neil Mitchell
4772c537d6
Move to creating a single HscEnv that we reuse in all GHC sessions rather than a fresh one each time (#1179) 2019-05-16 13:17:17 +01:00
Martin Huschenbett
cbeccb79ec
Add complex contract keys to DAML-LF (#1162)
* Add complex contract keys to daml_lf_1.proto

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

* Adapt Scala implementation of DAML-LF protobuf encoder/decoder
2019-05-16 13:46:01 +02:00
Martin Huschenbett
415e76b8c6 Test DAML-LF version 1.dev in damlc integration tests (#1135)
Currently, we test the default and the newest DAML-LF version. After the
recent introduction of 1.dev, this doesn't make sense anymore. Instead, we
now test the default version (which should always be the newest version)
and the dev version.
2019-05-15 15:49:22 +00:00
Neil Mitchell
abb8af60cf
IDE GHC 8.6 Compatibilty (#1148)
* Rename the #ifdef for GHC_STABLE

* More CPP required for GHC stable

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

* HLint ignores

* Finish the dummy implementations

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

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

* Switch to Haskell-based tar extraction
2019-05-14 21:55:45 +02:00
Neil Mitchell
41697cecbd
Support CPP in the IDE (#1131)
* Hide ghc-boot by default

* Add support for CPP

* Delete redundant comment
2019-05-14 20:00:19 +01:00
Neil Mitchell
388a2b49f7
Add utility function for the IDE Logger (#1132) 2019-05-14 16:51:20 +01:00
Remy
2e3a87934b Daml lf type safty (ChoiceName, VarName, FieldName, ConstructorName) (#983)
* daml-lf: make DefinitionRef more typesafe

* daml-lf: Identifier -> DefinitionRef

* daml-lf: remove unsafe apply and copy methods from DottedName

* daml-lf: create identifier

* daml-lf: make ChoiceNames Identifiers

* daml-lf: cleanup TVar

* daml-lf: FieldNames & VariantConstructors -> Identifiers

* bazel fmt

* daml-lf: VarName -> Identifier

* daml-lf: drop return inside Ref.scala

* daml-lf Identifier -> Name

* daml-lf DefinitionRef -> Identifier

* daml-lf make iface more type safe
+ address Francesco's comments

* daml-lf: remove unsafe unapply from MatchingStringModule

* fix navigator

* Address Stephen's Comments
2019-05-13 11:17:12 +00:00
Robin Krom
fac312dd40 language: fix: move interface files to a different (#1074)
* language: fix: move interface files to a different

This fixes https://github.com/digital-asset/daml/issues/1009. We move
the created interface files and hie files to a hidden directory
".interfaces" when creating a package.

* removing the ifaceDir option and hardcode the dir
2019-05-10 16:40:15 +00:00
Moritz Kiefer
a0338bdc6a Move moduleNameString to DA.Daml.LF.Ast.Util (#1065) 2019-05-10 10:41:55 +02:00
Moritz Kiefer
218bd691f2 Fail if modules listed in exposed-modules are not in the DALF (#1054)
fixes #1041
2019-05-10 02:37:27 +00:00
Shayne Fletcher
80158c451e Update to ghc-lib-0.20190509 (#1064) 2019-05-10 00:50:55 +00:00
Francesco Mazzoli
de54e8f60f
dynamically check type of contract ids, fixes #1005 (#1037)
Up to now, the engine blindly assumed that contract ids pointed to
contracts of the right type. However, this assumption is faulty:
contract ids coming from the Ledger API cannot be type checked
in command translation since we need access to the contract itself
to do so.

This caused some seriously surprising / broken behavior: one could
send an exercise command with the wrong template id and still go
through, or break internal invariants about the type of choices.

This commit fixes this by checking that the type of the contract
instances we fetch is correct at runtime.

cc @hurryabit @dajmaki @remyhaemmerle-da @S11001001 @meiersi-da
2019-05-09 17:11:05 +02:00
Neil Mitchell
0948789386
Improvements to the IDE (#1006)
* Make the extensions of the Haskell files configurable

* Make sure we capture the errors from parsing, not the warnings
2019-05-08 14:27:51 +01:00
Robin Krom
731b409537
compiler: follow ghc convention and put conf files in package.conf.d dir (#978)
* compiler: follow ghc convention and put conf files in package.conf.d dir

We follow the ghc convention and locate all .conf files for the package
database in the `package.conf.d` dir.

* addressed neil's comment
2019-05-08 14:23:04 +02:00
Moritz Kiefer
2149c86c8a
Implement cross-package goto definition (#972)
* Implement cross-package goto definition

This is more tricky than one might think at first:

- The interface files do not contain proper source spans so we cannot
  use the information in there.
- We could theoretically try to get the source location from the DALFs
  but that is the wrong layer and also not an option when we want to
  act as a Haskell IDE.

So what we do instead is whenever we write interface files we also
write .hie files and consult those instead when we get useless source
spans otherwise.

* Move optLocateHieFile and optLocateSrcFile to a separate type
2019-05-07 15:39:46 +02:00
Neil Mitchell
1f504ceb9c
Clean up UtilGHC (#963)
* Remove a duplicated comment

* Remove traverse from the convertor

* Move removing typeable to the converter

* Don't reexport getGhcCore

* Move coresForFile to its usage

* Just print out the GHC Core for everything, including internal modules

* Move modIsInternal out of haskell-ide-core

* Move some DynFlags setters over to Config

* Remove an unused orphan instance

* Move the orphans out to a different module

* Move functions for generating import syntax out of haskell-ide-core

* Expose fakeDynFlags as a blob, not the pieces

* Clean up the definition of fakeDynFlags

* Inline showSDocDefault

* HLint

* Fix the comment on IDE.Orphans
2019-05-07 12:42:48 +01:00
Neil Mitchell
a9b5ffd9e0
Clean up the IDE (#961)
* Split the Options into a separate module

* Make the Logger handle live in IO

* Reduce the amount of IDE logging to just two

* Rename CompileOpts to IdeOptions

* Rename PackageState to PackageDynFlags

* Clean up setting the PackageDynFlags

* Stop hiding PackageState, we no longer clash on it

* Introduce a helper for collecting the package flags

* Move the StringBuffer conversion to its only use
2019-05-07 10:19:12 +01:00
Neil Mitchell
68b0430284
GHC 8.6 compat for the IDE (#955)
* I have no idea now LPat and Pat previously managed to unify...

* Avoid using unRealSrcSpan as its only introduced for GHC 8.8

* Add some CPP to permit compiling with GHC 8.6

* Permit CPP in one more place
2019-05-06 21:29:22 +01:00
Remy
0489c6e0a5
Daml lf type safty (Party & PackageId) (#761)
* daml-lf: split SimpleString into Party and PackageId

* daml-lf remove parameter from DefinitionRef
2019-05-06 20:40:43 +02:00
Neil Mitchell
54c6e441f0
Minor IDE cleanups (#945)
* Kill RealLocated, it just duplicates something already in GHC

* Move some things back to UtilGHC, they are useful for setting DynFlags values
2019-05-06 18:35:43 +01:00
Neil Mitchell
1a069ad80b
Move the DAML config stuff out of haskell-ide-core (#940)
* Move the GHC config stuff out of haskell-ide-core

* Add an export list to UtilGHC
2019-05-06 14:11:36 +01:00
Neil Mitchell
c3a8a4d02a
IDE cleanups and progress towards external usability (#930)
* Remove the requirement for Binary on Shake rules (was not used)

* Add a deriving Show on Event, easier for external integrations

* Rename GeneratePackageState to LoadPackageState and move its fields to the rule, rather than the key

* Inline getPackageState away

* Change to passing a ModRenaming to the package loader. Two reasons:
1) When loading non-DAML things we might want to omit the renaming
2) The type ModRenaming has documentation of semantics, unlike [(String, String)]
2019-05-06 10:57:17 +01:00
Neil Mitchell
df02a5399f Avoid using package imports (#924)
* Hide the package ghc-boot-th by default

* Don't use package imports in haskell-ide-core
2019-05-05 21:22:15 +02:00
Neil Mitchell
fe3e5c9639
Delete DA.Prelude (#914)
* Use DA.Prelude a lot less

* Make LANGUAGE pragmas have the right case

* Don't reexport DA.Prelude

* Remove more DA.Prelude imports

* Remove the nastiest renaming DA.Prelude

* Final removal of DA.Prelude

* Kill DA.Prelude

* Add missing dependencies

* More missing package imports

* More missing package imports

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

* Update compiler/daml-lf-ast/src/DA/Daml/LF/Ast/Base.hs
2019-05-04 18:51:56 +01:00
Neil Mitchell
3cab59ad6d Remove completely redundant imports of DA.Prelude (#911)
* Remove completely redundant imports of DA.Prelude

* Start chipping away at some NoImplicitPrelude too
2019-05-04 12:40:07 +00:00
DavidM-D
aacb94d798 Changed Diagnostics to FileDiagnostics (#897)
* Changed Diagnostics to FileDiagnostics

* Hlint fixes

* Fix tests

* Removed the lenses
2019-05-03 17:43:40 +00:00
Neil Mitchell
3ee6f4f096
Fix prettyRange so it prints ranges like it used to (#882)
Before it was garbled and wrong:
Range:    Range Start: Position Line: 2Character: 15End:   Position Line: 2Character: 15

After it's correct and like it was before:
Range:    3:15-3:17
2019-05-03 12:49:51 +01:00
Stephen Compall
f5490a5454 add LF 1.dev "minor dev version" (#709)
* clean up v3 contract key case in TransactionVersions

* clean up duplicate cases in ValueVersions.assignVersion

* make LanguageMinorVersion a proper ADT, aliased LanguageVersion.Minor

* port DecodeV1 to LanguageMinorVersion ADT via implicit conversion

- @remyhaemmerle-da might prefer the explicit application of Stable/Dev

* make releasePrecedes private

* add dev versions to the timeline

* copyright header for LanguageMinorVersion

* build the package database for 1.dev, support 1.dev as --target

* test presence and new-ness of "dev" in timeline

* report dev versions in engine info; note 1.dev target in release notes

* spec and governance rules on 1.dev and minor dev in general

* make the governance rule about dev more direct

* 1.x

* missed plural; thanks @leo-da

* further definition of 1.dev in LFv1 spec; thanks @remyhaemmerle-da
2019-05-03 10:36:45 +02:00
DavidM-D
9da8e91358 Restored filepaths to their error messages (#862) 2019-05-03 08:33:56 +02:00
Martin Huschenbett
df230912c7
Drop DAML-LF 1.0 support from compiler (#863)
* Drop DAML-LF 1.0 support from compiler

This will enable us to add `Functor`, `Applicative` and `Monad` instances
for `(->) r` in the `daml-stdlib`. We'll do this in a separate PR.

* Remove codegen test for DAML-LF 1.0
2019-05-02 21:35:06 +02:00
Neil Mitchell
176f8f415e Improve the error message if we can't find the file (#858) 2019-05-02 19:16:32 +00:00
Neil Mitchell
0b184ee3b6 Deal with NUL bytes in strings (#844)
* Make all Text tests be qualified to Scenario

* Remove the big list of tests from Text test

* Add DA.Text.reverse

* Move LitString decoding out to UtilGHC

* Rename the functions to match their GHC counterparts

* Fix pretty printing of LF strings containing weird characters, e.g. NUL or "

* Move to using an unpackCStringUtf8 which copes with GHC-style nuls

* Add lots of tests around NUL characters

* Use a safer CString function
2019-05-02 17:33:07 +00:00
Neil Mitchell
536b1ea87f Explicit export lists in the DAML-LF Haskell module (#813)
* Delete an entirely unused module

* Delete an entirely unused module

* Switch the compiler to use EUnit over mkEUnit

* Delete an unused module

* Whitespace only

* Clean up the API for World, don't expose the internals, better creation functions

* Clean up the type checker environment, don't expose the internals of Gamma, add a few helper functions

* Delete unused functions

* Explicit module export lists

* Fix the nub replacement hints

* Turn on the warning that we require module export lists

* Add an explicit export list
2019-05-02 10:12:31 +02:00
Shayne Fletcher
1d81e3e429 Enable -Wprepositive-qualified-module (#823) 2019-05-01 21:09:38 +00:00
Neil Mitchell
4040dffc7a
Start cleaning up pretty-print (#821)
* Move from prettyDiagnostic to prettyDiagnostics

* Remove as much pretty print stuff as we can

* Try moving duplicate named functions with similar semantics and identical types to different names

* Change to returning pretty printed outputs from Diagnostics

* Remove a redundant import
2019-05-01 19:06:00 +01:00
Neil Mitchell
5ed95bc64c
Move DA.Pretty into da-hs-base (#818)
* Move DA.Pretty into da-hs-base

* Bazel formatting

* Remove another instance of da-hs-pretty
2019-05-01 14:50:19 +01:00
DavidM-D
8da835489f New diagnostics implementation (#737)
* Switch to haskell-lsp

* Fix build of data-default on Windows

* Use ghc environment files to avoid overflowing CLI length limits
2019-04-30 22:51:53 +02:00
Neil Mitchell
836d65e0ba
Add explicit export list (#806)
* Add explicit export lists in some places

* Add another explicit export
2019-04-30 21:08:36 +01:00
Martin Huschenbett
06514c0382
Remove a few unused functions from DA.Daml.LF.Ast.Util (#805)
* Remove a few unused functions from DA.Daml.LF.Ast.Util

Most of them were used in the old DAML 1.0 to DAML-LF compiler.

* Make hlint happy
2019-04-30 20:47:32 +02:00
Martin Huschenbett
9dd8a4646e
Remove a few unused lenses and prism for the DAML-LF AST (#803)
This reduces our Template Haskell footprint.
2019-04-30 20:47:12 +02:00
Neil Mitchell
2cd7aa45c0 #564, fix JUnit tests (#799)
* Make the ScenarioService take an IO callback, not STM

* Remove a redundant space

* Use IO in preference to STM where we really don't care which is in use

* #564, always print out diagnostics for tests

* #564, fix getting the scenario names so if they can't be computed you give an answer

* Add a proper data type to represent pass/fail in the tests

* Centrailse printing a failure message

* Pull the test execution into a separate file, ensuring it always gives back an exit code

* Use nubOrd instead of Set

* Clean up how we figure out which files to test

* Fail if there are any errors

* Delete all the brittle failure tracking stuff

* Rename the compiler handle to h

* Only print out the successful results to stdout, since the unsuccessful ones end up in diagnostics

* Make JUnit output still print out the test results

* Make JUnit print out all the details

* Delete the stdio command path

* Break the bigger pieces apart in the test runner

* Inline testJUnit

* Shorten to UseColor

* Shorten to color

* Inline and comment part of the JUnit tests

* HLint

* Update daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Test.hs

Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>

* Fix an HLint refactoring snafu

* Fix up the damlc tests

* Tighten up a test by demanding it throws ExitFailure
2019-04-30 18:07:08 +00:00
Martin Huschenbett
1fee1ddddf
Move encodeHash function into DA.Daml.LF.Proto3.Archive (#797)
The only usage of `encodeHash` is in `DA.Daml.LF.Proto3.Archive`. This used
to be different in the past but since it isn't anymore there's no more
justification for a separate module for a single function.
2019-04-30 18:02:18 +02:00
Stephen Compall
a3e9aad147
remove major LF dev version (#681)
* removing major LF dev version from Haskell proto codecs

* removing major LF dev version from scenario service client

* missed import

* remove Scala support for dev major version; remove --allow-dev option from sandbox cli

* Version.minorFromCliOption function

* don't build daml-stdlib artifacts for dev major

* remove damlc CLI --target dev

* release note about removed dev major LF version

* governance now discusses minor dev, no more major dev

* don't build from daml_lf_dev.proto anymore

* remove daml_lf_dev.proto

* raise deprecated release

* reserve 9999 in the ArchivePayload sum, as suggested by @bitonic

* use reserved proto keyword, as suggested by @bitonic

- `reserved` cannot occur within `oneof` block

* remove --allow-dev test

* dev removal release note followed the previous release; move it back to HEAD
2019-04-26 13:10:09 -04:00
DavidM-D
f1159dcccf
Add lsp deps (#724)
* Added GPL free versions of haskell-lsp as a dependency

* Cleared something up that I didn't understand

* Fixed bazel files
2019-04-26 14:00:15 +02:00
Neil Mitchell
93d1c35c8b
Simplify IDE rules (#708)
* Move the IdeResult term  into the A data type

* Nothing ever consults the errors stored in A, so stop storing them

* Use the new Shake MonadFail Rules instance

* Document the information in the Shake database

* More documentation of the data in the Shake service

* Change getValues to avoid getting the diagnostics

* Avoid fmap over a pair, a bit weird
2019-04-25 22:04:01 +01:00
Martin Huschenbett
fffd8d03e8 Stop using Template Haskell to derive type class instances (#262)
* Stop using Template Haskell to derive type class instances

Template Haskell is notorious for causing slow build times. That's why we
remove the `makeInstances*` family of functions and use proper `deriving`
clauses instead.

* Make hlint happy

* Make hlint even more happy

* Derive Data

* Remove ToJSON instances from DAML-LF AST
2019-04-25 16:35:35 +02:00
Martin Huschenbett
eb049869f6
Clean up how we check DAML-LF feature support in damlc (#663)
* Clean up how we check DAML-LF feature support in damlc

Currently, we have a predicate that tells us whether a DAML-LF version
supports a specific feature. We replace this by a data type which captures
the name of a feature and the minimal DAML-LF version which supports it.

* Rename featureDisjunctionChoices into featureFlexibleControllers

* Error only once

Co-Authored-By: hurryabit <martin.huschenbett@posteo.me>
2019-04-25 14:41:35 +02:00
Francesco Mazzoli
a504bbdc9e make DAML-LF 1.3 the default (#654) 2019-04-25 08:10:44 +00:00
Neil Mitchell
85c72f87d1 Move to using proto3-wire from upstream (#480)
* Move to using proto3-wire from upstream

* Move to upstream proto3-suite, with some custom patches in my fork

* Delete the BUILD.bazel for hte proto3 stuff, not used and the test was failing

* Delete the old proto3-wire and proto3-suite forks

* Delete proto3-wire

* Prettify BUILD.bazel files, sort the deps

* Remove some special cases from the license checker

* Delete unused Nix files from grpc-haskell

* Switch to upstream proto3-suite

* Make old-time work on Windows

* Formatting

* Patch rules_haskell to use a response file for -optP to avoid overflowing argument size limits on Windows

* Update 3rdparty/haskell/BUILD.old-time

Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>

* Update the comments in old-time

* Use the revised location of proto3-suite
2019-04-24 15:59:08 +00:00
Stephen Compall
fef8a956ee use WithTxValue in place of VersionedValue more broadly (#643)
* GenTransaction.WithTxValue alias

* undo parts of parent dealing explicitly with serialization

* use GenNode.WithTxValue more often

* use Node*.WithTxValue more often
2019-04-24 13:54:41 +00:00
Martin Huschenbett
968bca7589 Check that contract keys are supported in DAML-LF type checker (#639)
Add a check to the Haskell implementation of the DAML-LF type checker to
make sure that the current DAML-LF version supports contract keys when they
are encountered.
2019-04-24 09:17:15 +00:00
Moritz Kiefer
416b0949fa Fix termination of scenario service on Windows (#629)
* Fix termination of scenario service on Windows

The lack of a proper Windows IO manager resulted in us being unable to
kill the conduits reading the output of the scenario service so `damlc
test` and `damlc ide` blocked forever. This PR fixes the problem by
shutting down the scenario service (by closing its stdin) before
killing the conduits .

* Use fail instead of error

* Add debugging output

* Remove debug output

* Bump timeout of perf test
2019-04-23 19:43:23 +00:00
gleber
aa70c7f64e
Enforce consistent formatting of BUILD files. (#412)
* Add buildifier targets.

The tool allows to check and format BUILD files in the repo.

To check if files are well formatted, run:

    bazel run //:buildifier

To fix badly-formatted files run:

    bazel run //:buildifier-fix

* Cleanup dade-copyright-headers formatting.

* Fix dade-copyright-headers on files with just the copyright.

* Run buildifier automatically on CI via 'fmt.sh'.

* Reformat all BUILD files with buildifier.

Excludes autogenerated Bazel files.
2019-04-12 13:10:16 +02:00
Martin Huschenbett
667a63a9b1
Add location information to DAML-LF produced by damlc (#390)
* Add location information to DAML-LF produced by damlc

This is required to get error locations in the scenario view. Rigth now,
the location information for `create`/`exercise` still points to the
template/choice. I'll fix that in a separate PR.

* Fix test expectations

* Fix more tests
2019-04-11 21:44:48 +02:00
Jussi Mäki
1f2246c822 Do not divulge contracts to observers in nonconsuming exercises (#325)
* Do not divulge contracts to observers in nonconsuming exercises

Disables support for non-default ledger feature flags, as they
are meaningless since ledger server logic does not respect the flags.
Instead of large refactoring to add support for the old flag settings,
it is best to disallow the deprecated flags, and later on phase out the
flags completely.

Re-enables test_divulgence_of_token in sandbox semantic tests.

Fixes #157.

* purge LedgerFlags entirely...

...since we only support one version of them anyway, and clearing them

* updated release notes
2019-04-11 14:41:35 +02:00
Martin Huschenbett
be7ce7174f
Turn off -Woverlowed-literals in damlc (#375)
* Turn off -Woverlowed-literals in damlc

This flag does not play well with location information obtained via `-ticky`.
Also, the error message you get from overflowed literals suggests to use
`-XNegativeLiterals`, which is a bad idea since it changes the meaning of
`(-1)` from `\x -> x - 1` to `negate 1`.

* Fix module name in test

Co-Authored-By: martin-drhu-da <31696042+martin-drhu-da@users.noreply.github.com>
2019-04-11 13:52:22 +02:00
Remy
07858455c1
Fix DAML runtime for the new DAML-LF type Map (#204)
* add a test for daml-lf/interface
* fix scala code gen
* fix extractor
* fix navigator backend/frontend
* key of Map are strings in proto/json
2019-04-10 21:30:33 +02:00
david-md-da
e165f1df00
Tag errors as errors rather than debug messages (#360) 2019-04-10 17:49:43 +02:00
Jost Berthold
1d50cd6ca6
HOTFIX damlc: allow for passing options to the underlying GHC (#346)
* HOTFIX damlc: allow for passing options to the underlying GHC

As `damlc` is based on GHC, it "understands" all options that GHC understands.
This PR introduces a way to use GHC options that are not exposed by the `damlc`
driver, by passing any number of `--ghc-option CUSTOM_OPTION` on the command line.

The code uses the GHC function which parses options inside files, so
prohibiting a few options that we would not want to expose (package db, output
file, etc).

All warnings that GHC emits during flag processing are presented to the user.

If an option contradicts a DAML compiler setting, the compilation will be
aborted with a GHC exception (calls makeDynFlagsConsistent internally).

* HOTFIX damlc: small clean-up
2019-04-10 21:48:08 +10:00
Martin Huschenbett
ace1b5efd3
Remove all traces of the long gone value restriction (#256)
* Remove all traces of the long gone value restriction

We remove the value check since it has only been used by one `damli` command.
We also remove the constant folding from the DAML-LF simplifier. It is more
likely to diverge from the semantics of the interpreter than to do any good.

* Make hlint happy
2019-04-08 14:54:30 +02:00
Martin Huschenbett
b14bf471f0
Remove empty scaffolding for potential static authorization checker (#251)
* Remove empty scaffolding for potential static authorization checker

* Make hlint happy
2019-04-05 17:48:17 +02:00