Commit Graph

1851 Commits

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