Commit Graph

1031 Commits

Author SHA1 Message Date
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
Martin Huschenbett
7c3cd8840b
Remove DefValueInfo data type (#252)
This was used by the old DAML-LF based record constructor/projection
inliner. We'bve recently replaced by an inlining mechanism which is part
of the conversion from GHC Core to DAML-LF.
2019-04-05 16:47:08 +02:00
Digital Asset GmbH
05e691f558 open-sourcing daml 2019-04-04 09:33:38 +01:00