Commit Graph

2049 Commits

Author SHA1 Message Date
Gary Verhaegen
de6f31c4d8
canton: allow depending on arbitrary sha (#16926) 2023-06-01 15:06:35 +00:00
nickchapman-da
587efe4401
[Upgrades POC] softExercise (#16893) 2023-05-31 12:21:39 +00:00
dylant-da
17ce9a2316
Emit updated numeric primitives in stdlib/compiler (#16852)
* Amend DA.Numeric & Prelude to use updated primitives, make Legacy module

* Replace legacy numeric functions with CPP

* starting fixes - WIP

* remove clauses from convertPrim

* fix integration tests using Pi with new parameter

* Split tests into pre-post DAML_NAT_TYPE_ERASURE

* reorder forall-quantified vars in numeric primitives
2023-05-30 18:18:05 +00:00
dylant-da
dbb5ed8bf1
Provide CLI for reading/writing/aggregating serialized test results (#16928)
* Add CLI flags for reading, aggregating, writing test results

* Add tests for reading, writing, aggregating, and aggregation + read

* Rename write-results/read-results to save-coverage/load-coverage

* Rename ResultsIO -> CoveragePaths
2023-05-30 16:58:57 +00:00
dylant-da
6058070637
Remove daml visualize / damlc visual (#16901)
* Remove daml visualize / damlc visual

* fix redundant imports

* remove visual-web subtest
2023-05-30 10:50:36 +01:00
Samuel Williams
0f1317370d
Improve Hoogle/damldocs (#16847)
* Implement Interface, template and choice entries in hoogle

* Update expected files with additional anchor for choice

* Fix new IT

* Added signatory to template docs

* Fix a couple bugs

* Update expected files

* Implement getChoiceControllerMap

* Display controllers in docs

* Update expected filess

* Final tweaks

* Fix expected file

* Fix controller for interface archives

* Update tests

* Fix following main merge

* Fix controllers for templates with lets

* Drop square brackets

* Switch hoogle definitions as discussed
2023-05-24 09:04:19 +01:00
dylant-da
943e140bbb
Add test generator for keeping Cabal files in sync (#16864)
* wip

* Add generate_cabal{_and_track}_cabal for keeping cabal files in sync

* lint

* Disable generate_and_track_cabal on windows

* Fix build script to generate comments on separate lines

* Fix sorting, detect alias rules for ghc-lib-parser

* allow specifying file in generate_and_track_cabal

* Fully qualify path to cabal generation target

* Add handler for daml_lf_dev_archive_haskell_proto

* fix trailing T;p

---------

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2023-05-23 10:00:02 +01:00
Moisés Ackerman
b55d80a881
Reinstate WronglyTypedContractSoft as Dev error (#16891) 2023-05-22 18:28:28 +00:00
Samuel Williams
434b33d1e5
Fix name clashes with choices (#16858)
* Fix name clashes with choices

* Update ghc version
2023-05-18 15:24:40 +01:00
Remy
912e9a9f33
[LF] make generic Dev interpretation error (#16859) 2023-05-18 13:01:43 +00:00
nickchapman-da
f88812f0e5
avoid adding WronglyTypedContractSoft error; wait until #16859 has landed (#16871) 2023-05-16 17:32:10 +00:00
Moisés Ackerman
990308ce53
[Upgrades PoC] softFetch (#16839)
* Refactor PackageMetadata construction

* Package Metadata now can include an upgraded package id

* define PackageInterface#lookupPredecessors

* Add SoftFetch in Daml LF

* Add softFetch function in Daml

* Add USoftFetch LFConversion primitive

* Define SoftFetch in terms of SBPromoteAnyContract

* daml_compile rule now takes upgrades arg

* Add script test for softFetch

* TODOs

* Check LF >= 1.dev when decoding 'upgradedPackageId' and 'softFetch' in DecodeV1.scala

* Check that softFetch is not called on templates with contract keys

* Seq=>List

* ModParser todo

* Extract PackageUpgradesIT from AbstractFuncIT

* Update docstring for SBPromoteAnyContract

* Fix build errors

* Fix build error

* DecodeV1Spec case for softFetch

* DecodeV1Spec case for upgradedPackageId

* EncodeV1 case for upgradedPackageId

* Fix build error

* Disable test due to cyclic dependency with canton

* Add transitive case to PackageUpgradesIT

* Clean up PackageUpgradesIT

* Fix build error

* Error if 'upgrades' field is present before featurePackageUpgrades

* Update doc on compileSoftFetchTemplate

* Reword WronglyTypedContractSoft error
2023-05-16 10:33:47 +02:00
dylant-da
5637a2e509
Test result serializability (#16850)
* define serializeable protobuf for test results

* Redefine serializable datatype, rewrite printTestCoverage to use it

* Fix bug in occurence counting

* Refactor/restructure code

* Implement choice/template printers, amend PackageId datatype

* Protobuf encoding/decoding

* Fix duplicate template choices for Archive

* lint auto-formatting for bazel

* fix lint for haskell

* fix bad paren

* lint

* Document test_results protobuf

* remove commented out nowarn compiler flags
2023-05-11 17:44:46 +00:00
Remy
6985849a4f
[Compiler] support for type erasure friendly Numeric LF builtins (#16787)
part of #11679
2023-05-03 17:34:41 +02:00
dylant-da
eb537914a4
Make scripts cancellable (#16588)
* Begin work on cancellable scenarios

* Stubs that pass typechecking, for bidirectional streams

* Place default value in running handlers

* Support start/stop requests

* switch script to scenario

* ScenarioServiceMain lint

* Fix nonexhaustive check

* Working but ugly

* Remove ugliness / print debugging

* lint

* Distinguish cancellation by timeout vs request, refactor ior

* lint

* Implement automatic cancellation of outdated scripts, and test

* lint

* Fix boolean blindness in script cancellation signal

* Add timeout & steps to script interrupt test case

* Add test case for hover resetting script progress

* Remove unused ReplacedByOtherThread datatype

* remove dead debugging print statements

* Improve semaphore code

* Turn handler structure into a Semigroup, handle multiple response error
2023-05-02 17:51:45 +00:00
Moisés Ackerman
e71c667778
Extract daml-dar-reader (#16786) 2023-05-02 16:17:23 +00:00
nickchapman-da
5a7451bdf4
[engine] choice authority: clarify remaining things to do (#16752) 2023-04-27 18:30:32 +00:00
Samuel Williams
4ace70f7b6
Sw/daml doc choice return (#16713)
* Add return label to choices in daml docs

* Update expected files

* Comments + update tests
2023-04-25 16:58:27 +01:00
Remy
47be2db143
[LF] Kill expirmental optimized text primitives (#16759)
Those have never proved their usefullness.
2023-04-25 15:42:03 +00:00
Remy
bd43e54d7d
Add new Numeric builtin compatible with type erasure in LF proto. (#16757)
part of #11679
2023-04-25 12:45:41 +02:00
Samuel Williams
b9f3a787e0
Increase port timeout and cpu reserve for canton tests (#16742)
* Increase port timeout and cpu reserve for canton tests

* Fix duplicate tag

* Update BUILD.bazel
2023-04-25 11:41:26 +01:00
Samuel Williams
969045af4d
Drop scenario support from integration tests (#16710) 2023-04-25 09:06:35 +01:00
Remy
7a17c19bbf
LF: Rename builtins that would need a witness to allow nat type erasure (#16743)
part of #11679
2023-04-24 15:02:11 +00:00
Samuel Williams
f73a569b9d
Final integration test changes (#16702)
* Immediate actions from meeting

* Convert last files, include note about odd behaviour

* Fix loop error locations

* Drop party test tags, test fetch/lookup over script

* Change abort style, comment fixes
2023-04-24 10:29:31 +01:00
nickchapman-da
353c6d903d
cleanup code for consortium design #1 -- withAuthority (#16708) 2023-04-19 11:12:36 +01:00
nickchapman-da
8ad44f5fbc
kill Node.Authority with fire (#16524) 2023-04-18 14:16:44 +01:00
nickchapman-da
ac68bdf416
[engine] kill Daml withAuthority / LF WITH_AUTHORITY (#16548) 2023-04-17 16:50:10 +01:00
nickchapman-da
1c4d9c2882
[engine] speedy evaluation for choice authority (#16658)
* Push choice authority through speedy evaluation

fix tests for choice-authorizers limits config

make calls to NeedAuthority as required from speedy begin-exerise builtin; and test

prepare for no authorizers check

* authorization check for NoAuthorizers
2023-04-17 08:28:26 +01:00
Moisés Ackerman
3ea97fa5f8
place 'templateTypeRepToText' behind its own feature flag (#16657)
* place 'templateTypeRepToText' behind its own feature flag

* move down WITH_AUTHORITY in daml_lf_1.proto
2023-04-11 17:46:07 +02:00
nickchapman-da
d4ddc63e81
rename (#16661) 2023-04-05 18:30:22 +00:00
Samuel Williams
660d3237de
Implement potential flake fix, run 100 times (#16659)
* Implement potential flake fix, run 100 times

* Remove test, slight refactor

* Move synchonization to ScriptStream
2023-04-05 16:06:42 +00:00
Samuel Williams
3121c95754
Move tests from sandbox to canton (#16640)
* Implement FreePort for Linux

* Refactor FreePort a little, add withCantonSandbox, convert tests

* Implement dynamic port range for windows

* Import readProcess

* Log macOS info

* Switch to locateRunfiles

* Add sysctl for macos

* Bracket correctly

* Change dir to mainworkspace

* Implement MacOS dynamic port range

* Improve regex matches
2023-04-05 15:28:43 +01:00
nickchapman-da
046552e1e4
[language] check accuracy of 1.dev markers (#16651)
* Consider and address all 1.dev version markers. Some stay at 1.dev. Some change to 1.15 or earlier.

* TYPEREP_TYCON_NAME stays at 1.dev

* remove stray "x"s in .rst file
2023-04-05 13:12:58 +00:00
nickchapman-da
3abbf2b972
[engine] Push choice authority through compilation pipeline (#16639) 2023-04-03 09:19:24 +00:00
nickchapman-da
629439d876
[engine] choice authority syntax (#16602) 2023-03-29 15:19:47 +02:00
Samuel Williams
67f87ad75f
Convert LSP tests (#16615)
* Convert lsp tests to scripts

* Tests are still flaky
2023-03-29 11:41:29 +01:00
Samuel Williams
04e28f6e21
Use unversioned daml-script where possible (#16609) 2023-03-29 11:39:50 +01:00
Samuel Williams
9aa586fb9e
Switch doctest to use scripts (#16573)
* Convert doctest over to using script.
Prim tests not working

* Add no-source flag to doctest so we can still run stdlib

* Fix damlDocTestntegration

* Add various comments, fix up flags
2023-03-27 16:18:41 +01:00
Samuel Williams
7965687da2
Convert ShakeIdeClient tests from Scenario to Script (#16587)
* Convert ShakeIdeClient tests from Scenario to Script

* Small tweaks
2023-03-27 14:28:20 +01:00
Samuel Williams
512cf5c769
Remove scenarios (or mention of) from a small batch of tests (#16575)
* Remove scenarios (or mention of) from a small batch of tests

* Small fix
2023-03-21 14:51:59 +00:00
Samuel Williams
4df21fe69a
Drop scenarios from incremental and data deps tests (#16559)
* Remove Scenarios from Incremental builds

* Remove scenarios from Data deps

* Fix IncrementalBuilds for different release version

* Drop warning flag

* Small fixes

* Small refactor
2023-03-17 12:58:22 +00:00
Samuel Williams
ddc27715ab
Scenario service error reporting fix (#16503)
* Return error through grpc with print in unexpected cases
Fix a couple error cases

* Fix spacing test

* Refactor HashingError to have explicit case
2023-03-16 14:42:39 +00:00
Remy
b26484da11
[Disclosures] Validate hash of disclosed contracts (#16470) 2023-03-16 10:19:54 +00:00
Samuel Williams
8e869a4809
Omit versions for daml-script/daml-triggers in EXPECTED.json files (#16549)
* Omit versions for daml-script/daml-triggers in EXPECTED.json files

* Rename replacer
2023-03-15 16:55:31 +00:00
Moisés Ackerman
98dd1a3045
Add dynamicExercise expression and builtin (#16431)
* Add dynamicExercise expression and builtin

* Add DAML_DYNAMIC_EXERCISE feature flag
2023-03-15 10:35:24 +01:00
Moisés Ackerman
3ce15c6094
daml damlc init reads build-options from daml.yaml (#16492)
* Extract cmdUseDamlYamlArgs

* Use cliArgsFromDamlYaml only for cmdUseDamlYamlArgs

* Add Init to cmdUseDamlYamlArgs

* Add DocTest and Lint to cmdUseDamlYamlArgs

* Drop unused CommandName constructors

* cmdUseDamlYamlArgs is now a function
2023-03-14 10:44:36 +01:00
Samuel Williams
bbc45727dc
Use jq -n everywhere (#16514) 2023-03-10 13:44:46 +00:00
Samuel Williams
1b5778ea53
Remove broken test file (#16517) 2023-03-10 14:03:55 +01:00
Samuel Williams
eb8bd8a753
Main batch of test changes (#16333)
* WIP Implement integration script test support

* Add ghc_pkg

* Get scripts to run in integration tests!
Add expected error to new test

* Slight refactor

* First batch of test changes

* Update a few more tests

* Automated: Add imports, rename script and party

* Add Cmd postfixes

* Further changes including archiveCmd, error/warning locations, test specific behaviour

* Convert next batch of tests over

* More test updates

* All integration tests passing

* Update desugar files

* Handle some TODOs

* Bring back script integration, this time tested for different SDK versions

* Small fixes

* Revert broken test to scenario

* Create failing test that covers behaviour

* Add Daml.Script to daml-docs tests

* Shift dependency installation to start of suite for performance

* Only pipe scriptPackageData to golden tests

* Update daml doc expected files

* Update ContractKeyNotEffective to do fetch in contract

* Minor fixes

* Fix 1.15 test

* Test modifications from comments

* Update desugar files

* Fix Examples file for determinism and memory-examples tests

* Final test tweaks

* Drop old TODO

* Fix list test not running

* Update desugar
2023-03-09 16:00:24 +00:00
Samuel Williams
95dda28129
Add warning for top level test-like definitions (#16438)
* Add warning for top level test-like definitions

* Missing commas

* Generalise script package check to be unversioned

* Add a note to release file
2023-03-09 10:09:40 +00:00
Samuel Williams
8e90882105
Add errors for self, this, and arg. Add many tests (#16459)
* Add errors for self, this, and arg. Add many tests

* All WarnUnsupportDamlNames flag, warn for non breaking names, update tests

* Rename flag, update test

* Update to merged ghc version, changelog
2023-03-09 09:14:39 +00:00
Moisés Ackerman
3ec0f53850
Renamer golden test ignores GHC uniques (#16487) 2023-03-08 10:45:57 +00:00
Samuel Williams
81b90cf57c
Add daml-doc --doc-ext (#16475)
* Fix daml-doc md links

* Update ext in hoogle db

* Missing argument

* Move behaviour behind --doc-ext flag. Add warning
2023-03-08 09:39:14 +00:00
Samuel Williams
11c11d024a
Bump integration tests timeout to 3s (#16460)
* Bump integration tests timeout to 3s

* Update loop errors
2023-03-07 09:27:12 +00:00
Samuel Williams
8f50d205c3
Add jq stream support to integration tests. (#16451)
Fix bond-trading test queries
2023-03-03 17:18:43 +00:00
Samuel Williams
60e286eb69
Pre-error on jq for errors in integration tests (#16444)
* Pre-error on jq for errors in integration tests

* Fix tests without lf queries failing

* Refactor to make `mainProj` the source of json path
2023-03-03 15:01:30 +00:00
Samuel Williams
4503f7b638
Update bond trading tests (#16442)
* Update bond trading tests

* Formatting

* Disable scenarios in bond trading memory test
2023-03-02 16:00:29 +00:00
Samuel Williams
e16055d876
Fix controller unused arg warning for interface archives (#16430)
* Fix controller unused arg warning for interface archives

* Run tests:daml-desugar --accept
2023-03-02 13:56:37 +00:00
nickchapman-da
af9f30d5fc
damlc, Simplifier: case for BEWithAuthority (#16433) 2023-03-01 16:08:25 +00:00
dylant-da
6771135dd7
Automatically run scenarios in Studio with "Autorun All Tests" setting for Daml Extension (#16398)
* Add `daml ide` flag --studio-auto-run-all-scenarios to automatically run scenarios in studio

* Control via dedicated Daml extension settings attribute, `Autorun All Tests`
2023-03-01 09:38:01 +00:00
Moisés Ackerman
3cf2b8eee0
Check stderr in damlc-test external calls, so it's available upon failure (#16418) 2023-03-01 10:10:00 +01:00
Moisés Ackerman
fa22f85b16
Renamer golden test now extracts output from dump file instead of stderr (#16379) 2023-02-28 16:19:19 +01:00
Samuel Williams
ab3ed9c935
Support importing Script.Daml to determinism & memory test file (#16392)
* Support importing Script.Daml to determinism test file

* Install daml-script in memory tests
2023-02-28 08:19:52 +00:00
nickchapman-da
fd75c5ece1
[engine] construct ResultNeedAuthority (#16390) 2023-02-27 15:13:30 +00:00
Samuel Williams
f52cd077d6
Remove breaking expected file (#16389) 2023-02-27 14:00:04 +01:00
dylant-da
014b0ccc36
Fix formatting of GHC type errors (#16368)
* Point to updated revision

* Fix test failures due to expectations for unformatted errors

* Fix pretty printer for EForbiddenNameCollision, amend test
2023-02-23 20:18:18 +00:00
Samuel Williams
370a468524
Add Daml.Script to daml-docs tests (#16366)
* Bring back script integration, this time tested for different SDK versions

* Create failing test that covers behaviour

* Add Daml.Script to daml-docs tests

* Shift dependency installation to start of suite for performance

* Only pipe scriptPackageData to golden tests
2023-02-23 11:51:34 +00:00
Samuel Williams
d6bc75fcc0
Bring back script integration, this time tested for different SDK versions (#16361) 2023-02-23 09:20:12 +00:00
dylant-da
adb01a7b68
Table and transaction view in daml test (#16353)
* Initial outputTables work

* refactor outputTables

* Fix duplicate ShowCoverage opt

* Export TableOutputPath & TransactionsOutputPath constructors

* Implement outputTransactions

* Fix redundant imports, unused fields

* Embed extension's CSS style into generated tables / traces

* lint

* Extract webview css without locateResource

* Check stylesheet exists before reading it, emit warning if necessary

* Refactor tryWithPath
2023-02-22 17:56:50 +00:00
Samuel Williams
1d8c361dc1
Revert integration test support until fixed (#16360)
* Revert integration test support until fixed

* Remove some missing changes
2023-02-21 14:19:37 +00:00
dylant-da
a90865d370
Show time elapsed on running scenarios in IDE (#16324)
* PoC: Add live script runner with intermediate live messages

* Unify live and non-live scenario service script runners

* Add live scenarios

* Clean up runLiveScenario

* dedupe runLiveScenario/runLiveScript

* return to onComplete mode

* Send status update every second

* Send progress events with milliseconds passed instead

* Fix runLiveScript -> runLiveScenario

* Show milliseconds passed in scenarios

* Sleep a random amount 300;600 ms

* Try to prevent older status updates from overwriting newer ones

* lint

* wrap errors appropriately

* Remove wrong secondary webview update

* Define variants inside companion object

* use abstract class instead of trait

* lint
2023-02-20 17:19:42 +00:00
Moisés Ackerman
dd9c07177f
Timeouts are now reported correctly for daml-script Scripts (#16344)
Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2023-02-20 11:03:21 +01:00
Remy
12c240e06e
[Speedy] do not need disclosed contract at Machine creation time (#16302)
This PR make several (small) changes on how the disclosed contract are
handle by the speedy machine.

(1) disclosed contract at not anymore pass a builtin time. They were
any pass latter using `SBCacheDisclosedContract`.

(2) disclosed contracts are first keep in their own cache,
disclosedContracts: Map[V.ContractId, CachedContract]. They are moved
to the cached for used contract only if used.  In fact we need to be
sure the used disclosed contracts pass through the
Speedy#addGlobalContract to verify the transaction limits are not
overpassed.
2023-02-17 22:59:41 +00:00
Samuel Williams
d3feb57b39
Support Script tests in integration suite (#16323)
* WIP Implement integration script test support

* Add ghc_pkg

* Get scripts to run in integration tests!
Add expected error to new test

* Slight refactor
2023-02-17 11:21:29 +00:00
Samuel Williams
fb55f4c1bb
Add signatory labels to create and fetch in tree view (#16291)
* Add signatory labels to create and fetch in tree view

* Switch node printing in scala and expected ledger files

* Update docs/images

* Update party formatting to use `x, y and z` and correct verb tense

* Update scala to match haskell, update tests and docs (except images)

* Cleanup code from suggestions

* Fix misformatting, refactor
2023-02-16 15:57:01 +00:00
Samuel Williams
0516143831
Fix warning about unused this in exception messages (#16313)
* Fix warning about unused `this` in exception messages

* Fix desugar tests

* Update ghc version

* Update test to include context
2023-02-16 15:32:30 +00:00
mziolekda
1a3980bf89
Separate test-common from the rest of the ledger code (#16307)
* move files

* format

* wrong file

* fix conformance tests

* add readme

* fix compatibility tests

* fix haskell tests
2023-02-14 15:29:13 +00:00
Samuel Williams
0c9ba9e691
Allow name shadowing in choices (#16306)
* Add bypassReduceLambda to allow shadowing

* Fix integration test

* Update ghc, update desugared cases

* Update ghc version
2023-02-14 11:39:42 +00:00
Samuel Williams
5c00481ae0
Source location plumbing (#16269)
* Update protobuf to include sourceloc for implements and coimplements
Relevant haskell changes

* Update error ranges in tests

* Extract source locations from various template/interface parts

* Improve ExprSource extraction

* Move location from instance head to template/interface parts
Add location to instance print
2023-02-10 16:26:34 +00:00
Samuel Williams
9fdeaf2ed4
Fix list pattern match warnings to use :: (#16278)
* Fix list pattern match warnings to use ::

* Add test case

* Update ghc version
2023-02-10 16:24:46 +00:00
Remy
a75db47275
[LF] factorize GlobalKeyWithMaintainers and KeyWithMaintainers (#16251) 2023-02-08 13:58:43 +01:00
Samuel Williams
90a0f13829
Implement name synonyms in error prints (#16242)
* Implement interface name synonyms in error prints
* Add View type synonym test
2023-02-08 10:33:57 +00:00
Remy
2851401df6
[ScenarioService] add evaluation timeout (#16204)
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2023-02-06 08:59:12 +01:00
Remy
aad8725ea7
[damlc] change default output to 1.15 (#16157) 2023-02-06 08:58:47 +01:00
Remy
68a718ef58
Revert "Revert "Reactive requires in surface language (#15570)" (#16222)" (#16231)
This reverts commit db6e87589a.
2023-02-03 13:05:48 +01:00
Remy
db6e87589a
Revert "Reactive requires in surface language (#15570)" (#16222)
This reverts commit e94f1a74a9.
2023-02-02 19:20:17 +00:00
dylant-da
c7ae5f1c93
Allow run tests manually (#16211)
* Add rules for running single scenarios, redefine RunScenario using them

* Turn runScenario into an action, not IO

* Add FormattingStarted custom message type

* Redefine OfInterest rule in terms of RunSingleScript

* lint

* fix broken renamed var

* Use getFilesOfInterest for diagnostics & uncompilable check

* explicitly run tests that need to be run

* Amend test

* Remove commented out code

* Remove vr formatting message
2023-02-02 17:59:11 +00:00
nickchapman-da
d406e0a8df
remove clunky of suffix from with-authority internal names (#16214) 2023-02-01 16:19:06 +00:00
Moisés Ackerman
e9963e88df
Unhide DA.Internal.LF.coerceContractId (#16180) 2023-01-27 15:24:11 +01:00
Remy
3603ba870b
[Speedy] add cooperative interuptions (#16129)
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2023-01-26 16:05:33 +01:00
nickchapman-da
4aa5b7d768
add new tx node type: Node.Authority (#16070) 2023-01-25 11:09:56 +00:00
Moisés Ackerman
8784ebd9ce
Add choiceController and choiceObserver functions (#16088)
* Add daml test file for choice functions

* Add HasChoice{Controller,Observer} type classes

* Add choice_{controller,observer} in LF

* Update GHC_REV

* Generate HasChoice{Controller,Observer} instances

* Remove manual instances in daml test file for choice functions

* Remove/forbid choice{Controller,Observer} before featureChoiceFuncs

* update *.desugared-daml golden files

* Apply code review suggestion

* Update GHC_REV (da-master-8.8.1)

Co-authored-by: Remy <remy.haemmerle@daml.com>
2023-01-18 14:50:00 +00:00
nickchapman-da
41fa30cfd4
add daml feature: DAML_WITH_AUTHORITY (#16075) 2023-01-16 15:18:22 +00:00
nickchapman-da
f32419da20
[engine] withAuthorityOf: support from Daml --> Speedy (#16029) 2023-01-16 12:55:34 +00:00
Carl Pulley
980464a866
Disable visibility checks for local contract keys (#15131)
Main part of  #14199

Co-authored-by: Remy Haemmerle <Remy.Haemmerle@daml.com>
2023-01-13 15:16:33 +00:00
dylant-da
03a76f4a61
Turn Daml-specific errors into suggestions on the original error (#16017) 2023-01-11 15:44:45 +00:00
Moisés Ackerman
4feeed6598
Use daml.yaml args in 'daml repl' (#15958) 2023-01-09 12:45:22 +01:00
dylant-da
0701488c40
Fix return type error for methods (#15999)
* Add tests for method result mismatches & for interface synonyms

* point to updated ghc
2023-01-06 12:54:34 +00:00
Gary Verhaegen
151e12b81a
bump copyright (#16002)
This is the result of:

- Updating `./COPY` to say `2023`.
- Running `./dev-env/bin/dade-copyright-headers update .`
2023-01-04 18:21:15 +01:00
Remy
e94f1a74a9
Reactive requires in surface language (#15570) 2022-12-19 09:28:43 +01:00
Bernhard Elsner
1f30da1f23
Remove "Module" from daml-doc H1 headers (#15862)
* Remove "Module" from daml-doc H1 headers

CHANGELOG_BEING
- Remove the word "Module" from the H1 page header of
- module pages and stop overriding the ToC headers to make
- the generated pages easier to use.
CHANGELOG_END

* Reinstate links in daml-docs rst TOC

* Update render tests

* Update golden tests

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-12-16 10:19:08 +00:00
Remy
f1aca5e11c
[Speedy] create Scenario Machine (#15588) 2022-12-16 08:20:42 +00:00
dylant-da
445104a41b
Custom error / fix error for wrong expected return type of a choice. (#15855)
* Point to updated GHC

* add test for choice result mismatch

* add test for interface

* point to updated ghc

* point to merged ghc
2022-12-13 18:08:32 +00:00
dylant-da
f9d7301024
Fix erroneous code action/lens suggestions in Daml Studio (#15731)
* point to updated ghc

* point to updated GHC

* point to updated GHCIDE

* point to updated ghc

* Make _requires_ non-writable by inserting dollar - amend detectors

* Make _choice_ declarations non-writable (add dollar)

* Add checks for dollar-gen'd code require/view/interface_instance/method

* point to updated GHC

* point to updated ghc

* satisfy changelog

CHANGELOG_BEGIN
CHANGELOG_END

* point to updated GHC

* Point to updated ghcide

* update desugar tests

* point to revised daml-ghcide

* point to updated ghc

* point to updated ghc

* replace with isDamlGenerated

* point to merged ghc and merged ghcide
2022-12-13 12:06:40 +00:00
Stephen Compall
1ac4199538
update qs, express for security (#15874)
- fixes for CVE-2022-24999

* upgrade qs, express in root

* upgrade qs in daml-extension

* upgrade qs, express in navigator
2022-12-12 15:52:19 -05:00
Stefano Baghino
18ed316827
Accept uppercase English alphabet letters in user IDs (#15832)
* Accept uppercase English alphabet letters in user IDs

changelog_begin
Accept uppercase English alphabet letters in user IDs
changelog_end

* Fix title case in docs change

Co-authored-by: Sergey Kisel <98825453+skisel-da@users.noreply.github.com>

Co-authored-by: Sergey Kisel <98825453+skisel-da@users.noreply.github.com>
2022-12-08 16:44:54 +00:00
dylant-da
caf6d1d22a
Fix internal interface instance count (#15806) 2022-12-07 13:37:47 +00:00
Moisés Ackerman
f35ebb8dcd
Move stdlib datatypes into stable packages (#15795)
* Move datatype DA.Action.State.State into a stable package

* Move datatype DA.Stack.SrcLoc into a stable package

* Move datatype DA.Random.Minstd into a stable package

* Skip doctest for DA.Action.State.Type

* Don't use magic numbers in CodeGenRunnerTests.scala

* Update comment in StablePackageTest.scala
2022-12-06 15:48:35 +01:00
Stephen Compall
c24c17d595
Javascript library security updates (#15798)
Incorporates fixes for

- CVE-2022-3517
- CVE-2022-37599
- CVE-2022-37601

* update minimatch in root
* update minimatch in daml-extension
* update minimatch in typescript libraries
* update minimatch and loader-utils in navigator
2022-12-05 12:40:46 -05:00
Moisés Ackerman
6bafad6b20
Fix dlint hints for DA.{Action=>Functor}.void (#15746) 2022-12-01 16:06:33 +01:00
Moisés Ackerman
ccb1df08a7
Use daml-base-anchors.json when '--input-anchor' unspecified (#15715)
* Use default anchors for daml-prim and daml-stdlib when building docs

This PR introduces two flags for subcommand 'daml docs':

* '--default-input-anchor' to use the default anchors defined by //compiler/damlc:daml-base-anchors.json. This is the default if neither '--input-anchor=PATH' nor '--no-input-anchor' are passed.
* '--no-input-anchor' to use an empty anchor map. This is used to build //compiler/damlc:daml-base-anchors.json, since it cannot depend on itself.

* break cyclic dependency
2022-12-01 10:08:07 +01:00
Moisés Ackerman
badfb9dcea
Improve error message for attempted use of '..' in record update (#15712)
* Update GHC_REV

* Add test case
2022-12-01 10:07:29 +01:00
dylant-da
05d9ee89f3
Improve interpretation error consistency (#15680)
* Add custom viewtype mismatch error

* Modify error message on EViewTypeMismatch to be like GHC error

* Make EUnknownMethodInInterfaceInstance error consistent w/ GHC

* Add MethodTypeMismatch error, sync with GHC error

* Prefix fields in new errors

* Intercept type mismatch in method to throw EMethodTypeMismatch

* Synchronize EUnknownField with GHC-side message

* Complete synchronizing EUnknownField with GHC-side error message

* satisfy lint and changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* lint

* Fix TypingSpec for new EMethodTypeMismatch

* lint

* lint again

* EFieldTypeMismatch error for ERecUpd/ERecProj mismatch, like in GHC

* lint
2022-11-29 13:02:46 +00:00
Gary Verhaegen
46a4804672
bump nix (#15628)
Partly because the current version is from February (of this year,
fortunately), and partly because I need a more recent one to bump node
to 18 and fix the GSG for that.
2022-11-24 14:29:09 +00:00
dylant-da
ff6e776da0
Improve type error for Numeric types with precision > 37 and mistyped/missing field access (#15626)
* point to GHC with improved error

* Point to new GHC

* Fix error in RelTimeDetailsHidden1

* Point to updated ghc

* Point to new GHC

* Satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Fix assertion in RelTimeDetailsHidden1

* Amend tests with out-of-bounds NumericScale, point to updated GHC

* Drop quotes around type error

* Add tests for field access errors

* point to merged GHC
2022-11-22 15:44:25 +00:00
dylant-da
ccde982df5
Error for implementing non-interfaces (#15435)
* point to updated GHC

* satisfy changelog

CHANGELOG_BEGIN
CHANGELOG_END

* Point to updated GHC

* Expect new interface view error message in ImplementsNonInterface

* Add test for trying to implement a non-interface

* Point to GHC with better error suppression, fix tests

* Remove unused TryImplementNonInterface

* point to rebased ghc

* point to forwarded GHC changes

* point to updated GHC

* Fix expected error in ImplementsNonInterface

* Point to merged commit
2022-11-22 11:07:21 +00:00
Jonas De Vuyst
514a757e57
Add DA.List.chunksOf function in Daml stdlib (#15618) 2022-11-21 16:09:34 +00:00
dylant-da
1f998f95e8
Add interfaces & interface choices to coverage report (#15563)
* extract interface info for coverage

* Remove commented out Summary monoid code

* DRY up identifier creator

* remove unused summarize usage

* Disambiguate template/interface identifiers & choices via Variety

* Redesign extractors & start printing reports

* Reformat, begin proper counting of implementation choices

* Fix filter for interface archives choices to exclude, not include

* Remove commented code in printTestCoverage

* Fix lint

* Add external report

* Add percentages to coverage report

* Complete `External interface choices` report section

* Forgot to extract sizes from implementationChoices

* Remove unused allExercisedImplementationChoices

* Improve pctage reporter

* Report uncovered templates/choices when getShowCoverage is True

* Flip getShowCoverage check

* Fix width of percentages in coverage report

* Update damlc tests for coverage report

* Fix filter & text for external interface implementations

* Remove unused / misused Variant, Report, and interfaceChoices extractor

* add section header to never created/exercised summaries
2022-11-21 13:27:39 +00:00
Moisés Ackerman
c15617e87d
Fix view in view method definition (#15595)
* Update GHC_REV

* Update *.EXPECTED.desugared-daml

* Add regression test for #15459

* Method-in-method test now checks runtime behavior
2022-11-21 09:34:51 +00:00
Remy
7cac969756
[Speedy] Inline LedgerMode in the Machine (#15514) 2022-11-15 14:47:22 +00:00
Remy
d071e5e505
Remove TemplateOrInterface type class (#15347) 2022-11-15 09:44:51 +01:00
dylant-da
c6d10b6246
Remove GHC.Tuple.Check module (#15549)
* Prevent unused import warnings

* Remove all explicit occurences of GHC.Tuple.Check

* Update desugar tests

* Remove magic from GHC.Tuple.Check

* Add GHC.Tuple.Check back to DarReaderTest

* Point to merged changes
2022-11-14 18:29:35 +00:00
dylant-da
bb67fb7f51
Move userWrittenTuple check into own helper in GHC.Tuple.Check (#15445)
* Create tuple size check function in GHC.Tuple.Check

* Update desugar test

* lint

* Fix accidental minus in stable-packages

* Replace GHC.Types with GHC.Tuple.Check in doctest generation

* Fix DarReaderTest

* Fix DamlDocTest for GHC.Tuple.Check import

* Remove unnecessary DamlSyntax pragma

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>

* Point to merged GHC changes

* Point to akrmn's merged in changes

* Point back at merged in changes

* restart CI

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-11-11 15:59:29 +00:00
nickchapman-da
7abbb694b9
[script] rename: queryView --> queryInterface (#15541) 2022-11-11 11:50:02 +00:00
Moisés Ackerman
06892a4ae9
Clean up uses of locateRunfiles (#15446)
* Define DA.Bazel.Runfiles.locateResource as an alternative to locateRunfiles

* Use locateResource to get default dlint rules file

Fixes #15443

* Use locateResource to get scenario-service.jar

* Use locateResource to get ghc-pkg executable

* Use locateResource to get stable-packages directory

* Use locateResource to get ghcversion.h

* Use locateResource to get hpp executable

* Use locateResource to get builtin package dbs

* Drop unused function DA.Daml.Options.Types.getBaseDir

* Use locateResource to get d3{,plus}.min.js

* Use locateResource to get repl-service.jar

* data Resource now takes a runfilesPathPrefix instead of a runfilesPath

* Add hlint warning 'locateRunfiles/package_app'

* Let locateRunfiles crash when used outside of bazel target

* typo
2022-11-10 13:20:43 +01:00
Remy
49f4d2979e
[LF] strengthen compilation flags (#15481) 2022-11-09 14:12:04 +01:00
dylant-da
27f0f2b014
Catch mistyped view implementations via better Daml-specific type error detection (#15426)
* point to updated GHC

* satisfy changelog

CHANGELOG_BEGIN
CHANGELOG_END

* Point to updated GHC

* Expect new interface view error message in ImplementsNonInterface

* Add test for trying to implement a non-interface

* Point to GHC with better error suppression, fix tests

* Remove unused TryImplementNonInterface

* Point to merged GHC
2022-11-08 17:57:06 +00:00
dylant-da
1f2c728113
Fix overeager tuple warning (#15418)
* Success!

* Remove dead / unnecessary code from debugging

* Remove unused `userWrittenTuple` helper

* Import `GHC.Types.magic` where necessary

* Test for example in issue #15338

* satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Remove fst/snd lint tests, which weren't correct/useful anyways

* Update DocTest to import GHC.Types where necessary

* Update desugar tests

* Fix daml repl to include GHC.Types import

* Add GHC.Types to the doctest

* style improvement: if cond then action else pure () -> when cond action

* Point to merged GHC
2022-11-04 17:16:34 +00:00
Moisés Ackerman
a33127599e
Add coerceInterfaceContractId : (...) => ContractId i -> ContractId j (#15405)
* Replace '1.dev only'=>'Daml-LF >= 1.15' in docs for interface functions

* Define coerceInterfaceContractId

* Test coerceInterfaceContractId in InterfaceContractDoesNotImplementInterface

* Test coerceInterfaceContractId in InterfaceConversions

* Add entry for coerceInterfaceContractId in interface reference docs

* update *.EXPECTED.desugared-daml files

changelog_begin
- [Daml Standard Library] Added function ``coerceInterfaceContractId``
changelog_end
2022-11-02 10:48:12 +00:00
Moisés Ackerman
ae4d7c681b
Move regression test for #14291 into compatibility tests (#15390)
* Extract helper _validate_dar in data_dependencies.bzl

* Generalize daml_script_test from daml_script.bzl

* Move regression test for #14291 into compatibility tests

changelog_begin
changelog_end

run-full-compat: true
2022-11-01 10:39:16 +01:00
nickchapman-da
a20ac183aa
handle view computations which fail in daml-script (#15384)
changelog_begin
changelog_end
2022-10-28 17:05:18 +01:00
nickchapman-da
d14e68dc53
[daml-script] queryView (#15286) 2022-10-27 14:06:25 +01:00
Moisés Ackerman
d2f824fcc2
Fix DD test case 'Cross Daml-LF version with double data-dependency' (#15371)
The problem is that `damlcForTarget tools depLfVer` could return an older damlc
than needed for `targetLfVer`.

The reason this didn't fail before is that the legacy damlc supports up to
LF=1.14, and `lfVersionTestPairs` never had `depLfVer < 1.14 && targetLfVer > 1.14`

changelog_begin
changelog_end
2022-10-27 14:03:03 +02:00
Moisés Ackerman
484c40acb5
Update "Reference: Daml Packages" (#15324)
* Remove mention of FunctionalDependencies as data-dependencies caveat

FunctionalDependencies in data-dependencies have been supported since #7698

changelog_begin
changelog_end

* Remove mention of advanced type system features as data-dependencies caveat

module DA.Generics and language extension DeriveGeneric have long been removed
from the language, and I couldn't think of other similar "advanced type
system features" that work for plain dependencies but not for data-dependencies.

* Extend list of data dependable extensions
2022-10-26 11:56:29 +02:00
Moisés Ackerman
0dbc0424b8
Clean dlint flags (#15290)
* Clean `dlint` flags

changelog_begin
changelog_end
2022-10-25 16:12:38 +02:00
dylant-da
da8064de64
Add AnyView with HasFromAnyView instances (#15280)
* Implement AnyView as a stable package / primitive

* Point to updated GHC

* Export AnyView datatype, move typeclasses, fix convertPrim

* Adjust AnyView w/ InterfaceTypeRep, implement {to,from}AnyView

* fix lint, satisfy changelog

CHANGELOG_BEGIN
CHANGELOG_END

* fix daml-desugar

* Has{From,To}AnyView instances in daml-docs

* Add DA.Internal.Interface.AnyView to LibraryModules for stdlib

* Fix hash for DA.Internal.Interface.AnyView

* Prefix AnyView with CurrentSdk, add to golden for daml-script test

* Remove HasToAnyView

* Split AnyView into AnyView and AnyView.Types

* fix hash

* Remove unused StandaloneDeriving

* Add HasField instances (requires relevant workers)

* Accept desugaring test changes for removal of HasToAnyView

* Update daml-doc for removal/modification of HasToAnyView/HasFromAnyView

* Update StablePackage hash for DA.Internal.Interface.AnyView.Types
2022-10-25 11:49:32 +00:00
Remy
b0d840019b
[Script] Do not use type constructor in AnyInterfaceChoice anymore (#15188)
companion PR of digital-asset/ghc#137

CHANGELOG_BEGIN
CHANGELOG_END
2022-10-20 10:30:20 +00:00
dylant-da
0efadf61eb
GHC - Extract more info about templates (#15170)
* Point to fixed GHC

* Fix daml-test-files for improved GHC errors

* Fix error message to match critical parts of improved GHC errors

* satisfy changelog

CHANGELOG_BEGIN
CHANGELOG_END

* point to updated GHC

* Point to updated GHC

* Fix damlc tests for new GHC error messages

* Point to updated GHC
2022-10-19 15:47:45 +00:00
nickchapman-da
d654321432
daml-script: support query by interface-id (#15234) 2022-10-18 09:32:46 +00:00
Moisés Ackerman
7e6908612b
Fix instance Show Text to produce escaped Text (#15235)
* Fix `instance Show Text` to produce escaped Text (#15177)

This adapts the code used in GHC's 'instance Show Char where { showList }', representing characters as single-character
'Text's using a type synonym. CPP can be used during development to switch to a newtype-based implementation in order
to check type safety.

changelog_begin
- [Daml Standard Library] ``show @Text`` now escapes special characters, producing syntactically correct expressions (#15177)
changelog_end

* Add daml-test-file testing `show @Text`

* Avoid 'explode' in 'showLitChr'

* Cleanup 'showLitChr'

* Update DarReaderTest.scala

* Clean up import of GHC.Base

* Add Note for __DEBUG__SHOW_TEXT_CHR_NEWTYPE macro

* Extract longStringSize from longStringOf in daml-test-file ShowText.daml

* Document differences with GHC implementation

* Remove redundancy between showLitChr and {ascii=>ctrlChrText}

* Add 'exhaustive' test case in daml-test-file ShowText.daml

* Change 'ctrlChrText' default case to throw error
2022-10-17 18:07:56 +02:00
Rex Ng
e724982a9e
Generalize the <?> operator to support a generic error type (#15244)
The original implementation forces the caller to always use Text as the error type. This is unnecessarily restrictive as the types can be polymorphic on the caller's side.

CHANGELOG_BEGIN
* [Stdlib] Generalize the (<?>) operator to support a generic type for Validation
CHANGELOG_END
2022-10-17 14:41:00 +02:00
dylant-da
cedb09825a
Only report coverage for package-local choices/templates (#15150)
* Only report coverage for package-local choices/templates, add extra info

* Unify information for printTestCoverage

* Extract modules from all packages & local modules, not just tested ones

* Create reports about local/external choices/templates

* Remove unnecessary reporting

* Report local package coverage, external package coverage, all coverage

* Refactor printReport

* fix test, satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Fix another test

* Fix wording to `defined in local/external package`

* Check coverage against all modules in scope, not just tested modules

* Fix wording again, back to local/external modules - more accurate

* Replace TemplateInfo with Qualified Template
2022-10-11 15:57:36 +00:00
fayi-da
69f11311df
npm resolutions for daml extension (#15203)
* npm resolutions for daml extension

* Remove unnecessary dependencies

* No changelog

CHANGELOG_BEGIN
CHANGELOG_END
2022-10-11 11:42:36 +00:00
Moisés Ackerman
7f19bf258a
Check package name of preprocessor-excepted modules (#15184)
* Ensure daml preprocessor is only skipped when building 'daml-{prim,stdlib}'

changelog_begin
changelog_end

* Test that the daml preprocessor can't be skipped simply by changing the module name
2022-10-11 12:11:36 +02:00
nickchapman-da
ef959deeac
[engine] improve stacktrace for daml-script InterpretationError (#15178)
* improve stacktrace for daml-script InterpretationError

changelog_begin
changelog_end

* adapt expected regexp
2022-10-06 15:54:50 +00:00
Moisés Ackerman
ccb7ef7167
Add HasField instances for DA.Stack.SrcLoc (#15163)
* Add HasField instances for DA.Stack.SrcLoc (#15142)

changelog_begin
[DA.Stack] The SrcLoc datatype now supports dot syntax for field access (#15142)
changelog_end

* Add daml-test-file SrcLocFields to test dot syntax on DA.Stack.SrcLoc

* Define 'HasField f SrcLoc t' instances using record syntax
2022-10-06 11:53:22 +02:00
dylant-da
485eb2b8dd
Archive choices for interfaces (#15085)
* Point to latest GHC with archive choices on interfaces

* Update Desugared daml for interfaces Archives

* satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Update daml-doc test files

* Add relevant identifiers to SignatureReaderSpec for iface Archive choice

* lint

* Point to GHC with generated HasArchive instance

* Add test for archive on interface

* Test that second archive doesn't work

* Update desugar tests

* Point to GHC merge
2022-09-29 10:57:07 +01:00
nickchapman-da
68b323635d
[engine] prefer lastLocation to stackTrace (#15111)
TLDR: Remove broken code which constructs stackTrace().
Happy never to have to read those NOTE(MH) comments in the pushLocation code again!

(1) This code was fundamentally broken for various reasons:
- It doesn't make sense to track location info on the continuation stack. The continuation stack is a record of the evaluation still to come; not a context for the current evaluation.
- Stack traces can't sensibly be provided in a language such as Daml which promises that tail-recursion is evaluated in constant stack-space.
- Attempting to keep location info on the continuation stack does not play well when exceptions are thrown and the stack is unwound.

(2) The stack-trace management code was also very hacky:
- The pushLocation code contained special cases when the continuation stack was headed by a KArg/SToken continuation. This is an internal implementation detail. The KArg doesn't even exist when we stop using the deprecated SEAppGeneral expression constructor.
- The pushLocation code also contained special support for copying stack-traces into SEVal and SDefinition caches, and then later back on to the continuation stack. Yuck!

(3) The stackTrace() code was barely used:
- Some time ago an alternative/simpler location tracking system (lastLocation) was implemented.
- Only ScenarioRunner makes use of the stackTrace()
- Only a single test changes behaviour when we drop use of stackTrace() in favour of getLastLocation
2022-09-28 13:15:08 +01:00
Moisés Ackerman
8411a960b1
Daml Studio: Suggested type signatures no longer qualify HasField typeclass (#15106)
* Add test for typesignature.add codelens with HasField

* Reexport class HasField from DA.Internal.RebindableSyntax

* Update expected signature in test for typesignature.add codelens with HasField

changelog_begin
- [Daml Studio] Suggested type signatures no longer qualify HasField typeclass
  See `#13790 <https://github.com/digital-asset/daml/issues/13790>`__.
changelog_end

* Update expected error in RelTimeDetailsHidden1 daml-test-file
2022-09-28 10:38:32 +00:00
Rex Ng
b204aa5fbe
Add Semigroup, Foldable, and Traversable instances for Validation (#15080)
CHANGELOG_BEGIN
* [Stdlib] Add Semigroup, Foldable, and Traversable instances for Validation
CHANGELOG_END
2022-09-26 18:25:31 +02:00