Commit Graph

1149 Commits

Author SHA1 Message Date
Moritz Kiefer
1780f4cd93
Fix qualified name handling in DAML REPL (#7544)
* Fix qualified name handling in DAML REPL

This fixes the issue reported in
https://discuss.daml.com/t/how-to-use-qualified-template-names-in-repl-queries/1329/7

We need to print names qualified otherwise, the type signature for
following lines will be ambiguous even if users qualified the name in
their input. Figuring out the right name to use in qualification is
tricky but Luckily GHC provides this already so we just have to make
sure to plug it into the right places.

changelog_begin

- [DAML REPL] Fix a bug where you got an error about a name being
  ambiguous even if you used a qualified name.

changelog_end

* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Repl.hs

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Factor out typechecking of imports

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2020-10-02 12:16:17 +00:00
Bernhard Elsner
cfed918e40
Fix bifunctor docs (#7552)
* Fix bifunctor docs

- Remove non-implemented Haddock markup
- Fix code blocks
- Fix Lexer to accept `≡`
- Change Haskell REPL `>>>` to DAML REPL `daml>`

CHANGELOG_BEGIN
CHANGELOG_END

* Further improvements
2020-10-02 11:48:03 +00:00
Martin Huschenbett
6ec61bf506
Write proper SDK version in DAR manifest for snapshots (#7546)
* Write proper SDK version in DAR manifest for snapshots

Currently, we don't write the actual SDK version in the DAR manifest but
rather the version that has been sanitized for `ghc-pkg`. For proper
releases, these are identical but for snapshots the latter does not
contain the `-snapshot` part and the commit hash because `ghc-pkg` can
only handle numeric components.

This PR changes this behaviour such that we write the actual
unsanitized SDK version in the DAR manifest.

The implementation might look a bit unintuitive. However, we use the
`PackageSdkVersion` type for exactly two things:

1. Writing it into the manifest.
2. Using it to initialize the package database.

As mentioned above, the former should not be sanitized whereas the
latter should. So far, we've done the sanitization right after reading
the SDK version from `daml.yaml` or `DAML_SDK_VERSION`. Now, we do the
sanitization only in the code concerned with initializing the package
database.

CHANGELOG_BEGIN
[DAML Compiler]
- Bugfix: write the proper SDK version in the DAR manifest for
  snapshot releases instead of a sanitized version
CHANGELOG_END

* Drop SdkVersion.toGhcPkgVersion entirely

CHANGELOG_BEGIN
CHANGELOG_END
2020-10-02 12:59:18 +02:00
Sofia Faro
0382a62965
Fix data-deps dictionary function name mismatches. (#7539)
* Fix data-deps dictionary function name mismatches.

Fixes #7362. Incredibly, it's possible to fix this issue in
data-dependencies by sorting instance names in a funny way.
This is definitely a hack, but it should fix this issue,
which affects overlapping instances as well.

This PR adds a regression test.

changelog_begin
changelog_end

* Fix comments

* apply suggestion
2020-10-01 12:11:10 +00:00
Moritz Kiefer
293e5c55fa
Split DecodeDar into a separate module (#7530)
I originally implemented this for another change where I didn’t need it
in the end. However, it seems like a nice cleanup so spinning it out
into a standalone PR.

changelog_begin
changelog_end
2020-09-30 15:44:22 +02:00
Moritz Kiefer
b9a1905dab
Fix exposed packages in DAML REPL (#7529)
To make `--import` work we also need to expose the
packages. Otherwise, we end up with a ton of confusing errors as soon
as you try anything. Luckily, we can do this fairly cheaply by using
the fact that GHC can expose both unit ids as well as just package
names. Until I realized that I started working on a different approach
of reading the DALFs first to resolve unversioned packages but that
seemed much more messy.

changelog_begin
changelog_end
2020-09-30 13:53:42 +02:00
Tamás Kálcza
9d0206fc44
Added undefined function (#7058)
* Added ??? operator.

CHANGELOG_BEGIN
- Added `(???)` to Prelude.
CHANGELOG_END

* Renamed (???) operator to undefined.
2020-09-30 10:56:28 +02:00
nickchapman-da
689582be6e
Tests for all kinds of Authorization Failure. (#7479)
changelog_begin
changelog_end
2020-09-30 09:01:39 +01:00
Sofia Faro
e9cd92f061
Deprecate the "daml 1.2" version header. (#7513)
* changelog_begin

- [DAML] The "daml 1.2" version header is now deprecated.

changelog_end

* fix some line numbers

* fix some more locations
2020-09-29 13:14:59 +00:00
Moritz Kiefer
00b80b8ea3
Separate off-ledger ond on-ledger speedy (#7501)
* Separate off-ledger ond on-ledger speedy

changelog_begin
changelog_end

* Add OnLedgerBuiltin abstract class

changelog_begin
changelog_end

* fix typo

changelog_begin
changelog_end

* Fix borked rebase

changelog_begin
changelog_end

* Remove unscoped withOnLedger

changelog_begin
changelog_end
2020-09-29 10:05:45 +00:00
Sofia Faro
c5d145358d
Patch ghc to add a daml version header marker. (#7489)
* Update ghc to add a daml version header marker.

(WIP)

changelog_begin
changelog_end

* update stack snapshot

* See what happens with daml-doc

* update patch

* update stack snapshot

* unpin stackage

* Update daml docs tests

* Remove version header ann when parsing module doc

* Update the test

* Set final patch commit SHA.

* update stack snapshot

* unpin stackage (mac/linux)

* lint

* unpin stackage (win)
2020-09-28 17:01:20 +00:00
Sofus Mortensen
14f0a4d58e
Tuple tests - was: Added Functor instance for (,,) for completeness with fst3, curry3, etc (#7442)
* Added Functor instance for (,,) for completeness with fst3, curry3, etc

* added missing unit tests for DA.Tuple

* Reverted Functor instance on (,,)

* fix lint expectation line numbers

* Fix line numbers

changelog_begin
changelog_end

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-09-25 10:52:04 +02:00
Bernhard Elsner
331ee44978
Documentation of our support and compatibility framework (#7458)
* Documentation of our support and compatibility framework

CHANGELOG_BEGIN
CHANGELOG_END

* Update docs/source/daml-integration-kit/index.rst

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Update docs/source/support/component-statuses.rst

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Address feedback

* Update docs/source/support/compatibility.rst

Co-authored-by: Gerolf Seitz <gerolf.seitz@daml.com>

* Add Deprecations and address feedback

* Fix short title underline

* Apply suggestions from code review

Co-authored-by: Gerolf Seitz <gerolf.seitz@daml.com>

* Improve sentence on Integration Kit

* Imprive SemVer TLDR

* Uncapitalize release candidate

* Fix release timeline image

* Make the DAML Language Server CLI a Labs feature

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Gerolf Seitz <gerolf.seitz@daml.com>
2020-09-24 14:40:57 +00:00
nickchapman-da
eca7c78540
Tests for interleaved execution and authorization (#7476)
* Add new tests to demonstrate that authorizing checking is interleaved with execution. This work is a follow up to PR #7400, and relates to issue #132

changelog_begin
changelog_end

* naming and other small review comments
2020-09-24 11:38:56 +00:00
Martin Huschenbett
cfa05fa893
Deprecate daml damlc package (#7466)
This command will be deprecated as part of the 1.6 release.
`daml build` should be used instead to build DARs.

CHANGELOG_BEGIN
[damlc]
- Deprecate `daml damlc package` command.
CHANGELOG_END
2020-09-24 10:26:34 +00:00
Sofia Faro
fbb29de4b2
Force newtype constructor names to match type name. (#7467)
* Force newtype ctor name to match type name.

This PR fixes the record constructor check to include newtypes, which are represented as records in DAML-LF. The non-inclusion of all newtypes was an oversight. In addition, we add a regression test.

changelog_begin

- [DAML Compiler] bugfix: Newtype constructors must have the same
  name as the newtype itself, since newtypes are record types.

changelog_end

* Change error message on newtypes

* update a test
2020-09-23 15:36:18 +00:00
Remy
f5694ee2ea
LF: Kill ValueStruct (#7457)
Struct is not serializable and therefore should not appear as Value.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-22 13:37:59 +02:00
Remy
a899e5e4e6
Speedy: Check language version as part of Speedy compilation. (#7440)
Additionnally
+ move allowedLanguageVersion inside compiler config
+ add missing catch error insde
  ConcurrentCompiledPackages#addPackageInternal
+ implement EngineConfig method to easily produce a Compiler.Config

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-22 12:43:48 +02:00
Moritz Kiefer
566d3a21d1
Remove version header from vscode snippet (#7452)
changelog_begin
changelog_end
2020-09-21 16:59:47 +02:00
nickchapman-da
4e32fde001
Cleanup following interleave execution and authorization (#7437)
* remove failedTransactions field from ScenarioLedger.RichTransaction

changelog_begin
changelog_end

* remove Blinding.checkAuthorizationAndBlind; fixup callers to use Blinding.blind when blindningInfo is required

* rename/relocate: ScenarioLedger.CommitError.FailedAuthorizations --> SError.DamlEFailedAuthorization

* fix types to demonstate that at most one FailedAuthorization is detected/reported

* address small review comments
2020-09-18 19:05:19 +01:00
Remy
76ef4c861a
Speedy: group compiler parameters into a Config case class. (#7438)
* Speedy: group compiler parameters into a Config case class.

Speedy compiler is parametrized by several option flags.  Those flags
are passed through different calls (in particular in the instance of
`CompiledPackages`.

This PR group all this configuration parameters into a case class to
pass the option in a cleaner way.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-18 19:32:26 +02:00
nickchapman-da
96d704b25b
Perform authorization checks during execution and not as a separate post-execution phase. (#7400)
changelog_begin
changelog_end

Adapt test for small error message change. An improvement! Previously an internal message was shown. Make test flexible enough to pass for old & new message.

Adapt expected output file. Only change is the contract-ids for active-contracts when the test ends.

fix small test bugs in testcase where authorization is wrong

temp disabled 3 tests; needs investigation; see TODO markers

temp adapt 1 test for change in error message

temp disable 1 test. needs invesigation

undo accidentally commited change to .bazelrc

add copyright header to new file

remove testcase (badActorCheck2) which is no longer expected behaviour, when authorization occurs during execution

address comments: be mre private & other tiny changes

appease scala formatter

improve expected error message in KeyNotVisibleStakeholders testcase

fix authorization issues and re-enable the 3 failing tests in EngineTest which now pass

fix auth issue and re-enable ledger-test-tool test: WronglyTypedContractIdIT

fix compatibility

re-enable test in KVUtilsTransactionSpec.scala
2020-09-17 17:50:04 +01:00
Stephen Compall
a670e68c72
add 'alter' function to DA.Map (#7427)
* add 'alter' function to DA.Map

CHANGELOG_BEGIN
CHANGELOG_END

* swap arguments for alter

- suggested by @cocreature; thanks

* alter moved to stdlib, remove from trigger lib

* use markdown formatting for alter doc

- suggested by @sofiafaro-da; thanks

* fix code block formatting

- suggested by @sofiafaro-da; thanks
2020-09-17 16:46:37 +00:00
Stephen Compall
1926ddbe9d
avoid ACS linear contract ID lookups in Trigger library (#7425)
* add Ord (ContractId a) instance

* change inner list in activeContracts to map

* adapt Internal module to new map

* support rest of Trigger daml lib

* rename adjust to alter, its Data.Map name

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* distribute type arguments for ACS activeContracts

- suggested by @cocreature; thanks

* swap arguments for alter

- suggested by @cocreature; thanks

* reformat groupActiveContracts signature

- suggested by @cocreature; thanks
2020-09-17 15:31:03 +00:00
Stephen Compall
09014dc637
use GenMaps for trigger ACS (#7365)
* use GenMaps for trigger ACS

* Next removed for 1.dev

* temp port trigger test code to 1.dev only

* run trigger tests on 1.dev only

* move pending back to TextMap

* include trigger service in the 1.dev test lineup

- it takes >2min, so shouldn't be permanent

* add Ord TypeRep and Ord TemplateTypeRep when possible

* swap names in Internal to reduce the diff

* try to enable cpp for triggers compilation

$ bazel build //triggers/daml:daml-trigger-1.dev
<snip>
File:     daml/Daml/Trigger/Internal.daml
Hidden:   no
Range:    103:-1-103:-1
Source:   CPP
Severity: DsError
Message:  22 in hpp-0.6.1:Hpp.CmdLine
File:     daml/Daml/Trigger.daml
Hidden:   no
Range:    103:-1-103:-1
Source:   CPP
Severity: DsError
Message:  22 in hpp-0.6.1:Hpp.CmdLine
ERROR: Creation of DAR file failed.
<snip>

* remove problematic options for invoking cpp

hpp: Couldn't open input file: -Werror
CallStack (from HasCallStack):
  error, called at src/Hpp/CmdLine.hs:103:22 in hpp-0.6.1:Hpp.CmdLine

* enough cpp so default and 1.dev triggers compile

* cpp needed for docs as well

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* return trigger service to testing against sdk default lf version

* run trigger integration test against sdk default and LF 1.dev

* return trigger scenario test to SDK default LF version

* avoid import warnings in trigger lib

* Windows manifests a missing file differently. Hilarious
2020-09-15 12:30:23 -04:00
Sofia Faro
ef67efbaaf
Fix missing date under/overflow in DA.Date.date (#7393)
* Fix missing date under/overflow in DA.Date.date

changelog_begin

- [DAML Standard Library] Bugfix: DA.Date.date
  now raises an error when the day argument is
  outside the valid range.

changelog_end

* Add test for underflow too
2020-09-14 16:09:18 +01:00
dependabot[bot]
166c799618
Bump node-fetch from 2.6.0 to 2.6.1 in /compiler/daml-extension (#7389)
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

changelog_begin
changelog_end

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-14 11:44:15 +00:00
Moritz Kiefer
84fe505a58
Add queryContractKey to DAML Script (#7354)
* Add queryContractKey to DAML Script

This matches the behavior and the implementation of
`queryContractId`. We only return contracts for stakeholders and we
return an `Optional` so you can handle lookup failures. On the JSON
API and in DAML Studio this is fairly efficient, over the gRPC API it
degrades to a linear search.

changelog_begin

- [DAML Script] Add `queryContractKey` to the DAML Script API.

changelog_end

* Update daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/LedgerInteraction.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-09-10 19:39:23 +02:00
Moritz Kiefer
c0b6851abe
Generate hoogle docs for daml script/triggers (#7371)
* Generate hoogle docs for daml script/triggers

This PR switches over the documentation generation for daml script and
daml triggers to the multi-page format we already use for the standard
library and extends it to also generate hoogle documentation.

All 3 hoogle files are combined in a single hoogle_db.tar.gz archive.

Since the location in the multi-page format is different, I’ve added
redirects.

I verified locally, that I can generate the hoogle database and that
the links point to the right places.

changelog_begin
changelog_end

* Fix baseurl for daml-stdlib

changelog_begin
changelog_end
2020-09-10 15:58:15 +02:00
Sofia Faro
245f87fcaa
Add warning for variant constructor with unit arg. (#7369)
* Add warning for variant constructor with unit arg.

changelog_begin
- [DAML Compiler] The compiler will now emit a warning when you have a variant type constructor with a single argument of unit type ``()``. For example, ``data Foo = Bar () | Baz`` will result in a warning on the constructor ``Bar``.  This is because the unit type will not be preserved when importing the package via data-dependencies. The correct solution, usually, is to remove the argument from the constructor: ``data Foo = Bar | Baz``. Note that this rule does not apply when the variant type has only one constructor, since no ambiguity arises.
changelog_end

* Rename checks in preprocessor

* Weird lint but ok
2020-09-10 14:27:36 +01:00
Martin Huschenbett
a239edb0eb
damlc: Don't use uniques for type vars during conversion to LF (#7361)
We had some issues with shadowing of type variables in our DAML-LF type
checkers because of some bugs in our implementations of substitution. As
a workaround for these issues, we suffixed each type variable with its
GHC unique during conversion to DAML-LF. Unfortunately, this leads to
new problems when using parametrized variant types and record
projections in combination with data-dependencies.

This PR, drops the unique suffix when converting to DAML-LF. This
change is possible since we fixed the bugs in the substitutions a while
ago. Fortunately, this also fixes the aforementioned problem regarding
data-dependencies.

This fixes #7284.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-09 13:40:28 +00:00
Sofia Faro
220cfc5c79
Disable multipackage LSP tests on Windows. (#7360)
* Disable multi-package lsp-tests on windows.

These are consistently timing out on Windows for unknown reasons.
Disabling until we figure out how to fix the tests. See #4904

changelog_begin
changelog_end

* fix definition
2020-09-09 12:50:30 +00:00
Remy
78e770bf72
LF: Use the new Struct data structure for ValueStruct (#7241)
This PR uses the new data structure introduced in #7220.
Additionnally this fix `Value Equal instance` which was considering
<a: x, b: y> different from <b:y, a:x>.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-04 18:32:39 +02:00
Moritz Kiefer
3171bb588a
Migrate trigger assertion library to DAML Script (#7318)
This is clearly a breaking change but triggers are still alpha so we
can get away this (confirmed with Bernhard).

changelog_begin

- [DAML Trigger] Daml.Trigger.Assert now uses DAML Script instead of scenarios.

changelog_end
2020-09-04 13:48:50 +02:00
Moritz Kiefer
0903b1a6be
Filter implicit parameter instances from data-dependencies (#7320)
* Filter implicit parameter instances from data-dependencies

Occasionally GHC likes to float implicit parameters to the top-level
making them look like any other typeclass instances. Implicit
parameters are by design not unique so if we try to reconstruct them
we get an error about a duplicate instance.

I haven’t figured out when exactly GHC floats things to the top-level
but I did verify that this testcase breaks without the fix.

changelog_begin
changelog_end

* Assert that there are 2 implicit instances

changelog_begin
changelog_end
2020-09-04 07:36:37 +00:00
Sofia Faro
a938fd7773
Preserve empty variant constructor in data-deps. (#7303)
* Preserve empty variant constructor in data-deps.

This fixes #7207 and adds a regression test. In a
separate PR I'll add a warning for variants with
single argument of unit type and add a changelog
entry.

changelog_begin
changelog_end

* Add special case for single constructor variants

* Add test for special case
2020-09-02 21:16:16 +01:00
Moritz Kiefer
5e8196061e
Use implode in prettySrcLoc (#7305)
As pointed out by @hurryabit this is a bit nicer. The foldr was just
copied over from GHC.

changelog_begin
changelog_end
2020-09-02 12:43:01 +00:00
Moritz Kiefer
4460cb5e08
Fix trace statement handling in DAML Script service (#7292)
* Fix trace statement handling in DAML Script service

This PR makes sure that we get both trace statements coming from the
ledger client as well as from the ledger server. In the script service
those are two different Speedy machines so we need to interleave
them. This is a bit messy so let me explain the steps (apologies for
not splitting it up but I think it’s easier to understand the
motivation when it is a single PR):

1. Abstract over the tracelog interface. The ringbuffer doesn’t makes
   sense for our purposes and is annoying to clear.

2. Pass in the respective fields of `Machine` to `Conversions` instead
   of the whole machine. This is both a simpler design (passing around
   mutable objects scares me) and it allows us to assemble the fields
   from different machines.

3. Initialize the ledger machine with a simple ArrayBuffer tracelog.

4. After `submit` and `submitMustFail` copy the tracelog from the
   ledger to the client.

fixes #7280

changelog_begin
changelog_end

* Address review feedback

changelog_begin
changelog_end
2020-09-01 17:15:48 +00:00
Moritz Kiefer
09a1b445df
Only include stakeholder contracts in result of query (#7291)
* Only include stakeholder contracts in result of query

This fixes a bug in the script service. We need to filter out divulged
contracts since this should behave exactly like the ACS endpoint on
the ledger API.

changelog_begin
changelog_end

* Update daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/scenario/ScenarioLedger.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* Update daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/LedgerInteraction.scala

Co-authored-by: Remy <remy.haemmerle@daml.com>

* fmt

changelog_begin
changelog_end

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-09-01 10:34:11 +00:00
Moritz Kiefer
f8a82ad25f
Add queryContractId to DAML Script (#7289)
* Add queryContractId to DAML Script

I’ve switched between a few different naming options and in the end
settled on this one:

- `lookupContract`, not too bad but misses the connection to `query`
- `queryCid`, we don’t abbreviate this in other places in our API so I
  don’t think we should here.
- `queryContractId`, makes the connection clear and no
  abbreviation. We could also add `queryContractKey` later

changelog_begin

- [DAML Script] Add a `queryContractId` function for querying for a
  contract with the given identifier.

changelog_end

* Fix test

changelog_begin
changelog_end
2020-09-01 10:31:34 +00:00
Jost Berthold
6874f18f77
DEL-8132 extract DAML LF haskell libraries (scripted) (#7246)
An extraction script that makes the LF reading libraries (DAML LF archive decoding to an AST) usable in other Haskell projects.
This script once existed but is not available any more, so I have resurrected the script, adapted to current usage, and upgraded to the newest stackage LTS that can support it. These libraries _could_ be versioned manually to released SDKs and published if desirable (without making any guarantees about the stability, therefore prefixing the version with `0.`.

CHANGELOG_BEGIN
Tool to extract Haskell libraries for DAML LF archives for use in other Haskell projects
CHANGELOG_END
2020-09-01 12:09:26 +10:00
Moritz Kiefer
1eefb4b27d
Fix partial tx and commit locs in the script service (#7281)
It turns out we were too aggressive in resetting the state. We only
want to reset in `submit` on successful commit and in `submitMustFail`
on failed commits. I’ve also split the reset in two parts, one that is
done at the beginning every time and one at the end. I don’t think it
really makes a difference but it matches what the scenario runner does
which at least makes me stop wondering if the difference matters.

fixes #7275 fixes #7276

changelog_begin
changelog_end
2020-08-31 18:00:20 +02:00
Moritz Kiefer
b1530bed7a
Add passTime to DAML Script (#7269)
I’ve also removed the restriction to only support going forward since
scenarios don’t have that restriction and it seems potentially useful
for tests.

factored out from #7264

changelog_begin

- [DAML Script] Add `passTime` helper to advance the time by the
  given interval.

- [DAML Script] In DAML Studio, you can now set the time to the
  past. This is not supported when running against a ledger.

changelog_end
2020-08-31 13:25:09 +02:00
Moritz Kiefer
6743bf5b9b
Add archiveCmd to DAML Script (#7268)
Factored out from #7264 and added a test. Just makes the migration a
tiny bit easier.

changelog_begin

- [DAML Script] Add `archiveCmd cid` as a convenience wrapper around
`exerciseCmd cid Archive`.

changelog_end
2020-08-31 13:24:48 +02:00
Sofia Faro
4c7b07fec6
Add missing orphan superclass references when generating instances via data-dependencies. (#7267)
* Add test for issue 7256

* Fix the issue of missing references

changelog_begin
changelog_end
2020-08-31 11:57:56 +01:00
Andreas Herrmann
d937a5ebad
Track source locations on Daml.Script.submit (#7252)
* Track source locations on Daml.Script.submit

Adds a `HasCallStack` constraint on `HasSubmit.submit` and
`HasSubmit.submitMustfail`.

We need to move the definition of `HasCallStack` to `GHC.Stack.Types` to
avoid a cyclic dependency between `DA.Stack` and `DA.Internal.LF`.
Alternatively, we could inline `HasCallStack` in `DA.Internal.LF` but it
seems preferable to use the alias on the signature of
`submit(MustFail)`.

We need to adapt the type of the builtins for scenario `submit` and
`submitMustfail`.

changelog_begin
changelog_end

* Test-case for scenario/script source locations

* Test second commit with intermediate definition

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478518834

* Store the full callstack on submit

For forwards compatibility.

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478520268

* Document unused location definition

Addressing review commit
https://github.com/digital-asset/daml/pull/7252/files#r478522373

* Make user facing `SrcLoc` zero based

Following LSP precedent rather than GHC

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478529138

* Add comment for backwards compatibility code

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478529138

* fmt

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 12:22:15 +00:00
Andreas Herrmann
b812f09da9
Disable lsp-tests script tests on Windows (#7235)
The similar scenario tests are also disabled on Windows and the script
tests are flaky on Windows due to timeouts.

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-26 07:56:12 +00:00
Moritz Kiefer
d33e130f47
Enable DAML Script service by default and document it (#7229)
* Enable DAML Script service by default and document it

fixes #7193

changelog_begin

- [DAML Script] DAML Scripts are now run in DAML Studio just like
  scenarios. The functionality for inspecting the results is
  identical. If you encounter issues, please report them.

changelog_end

* fix double "is identical"

changelog_begin
changelog_end
2020-08-25 19:53:59 +02:00
Moritz Kiefer
3058af8286
Support HasCallStack constraints (#7217)
This is primarily intended to improve error reporting in DAML Script,
in particular, https://github.com/digital-asset/daml/issues/7192 which
is a blocker for replacing scenarios by DAML Script.

However, I think it is also a very reasonable feature in general.

changelog_begin
changelog_end
2020-08-25 08:54:21 +00:00
Gary Verhaegen
f54e193df6
add visibleByKey (#7146)
Adds a Boolean check for the existence of an active contract with a
given key (that is visible with the current set of authorizations), and
explain `lookupByKey` in terms of it to hopefully clarify the relationship
between `lookupByKey` and `fetchByKey`.

Fixes #7143; see that for more information.

CHANGELOG_BEGIN

- [DAML Standard Library] Added a new function `visibleByKey`
  which, given a contract key, returns True if the current context can
  see an active contract with that key.

CHANGELOG_END
2020-08-24 15:04:05 +02:00