Commit Graph

69 Commits

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