Commit Graph

281 Commits

Author SHA1 Message Date
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