Commit Graph

1799 Commits

Author SHA1 Message Date
Dylan Thinnes
87d6b540aa Temporarily disable failing damlc tests 2022-08-25 11:36:08 +01:00
Dylan Thinnes
05ea7bdb75 Update desugared daml for UExerciseInterface[Guarded] generation 2022-08-25 09:49:08 +01:00
Dylan Thinnes
14fdd5f725 Run damlc interface tests w/o requires when since DAML_INTERFACE 2022-08-25 09:44:59 +01:00
Dylan Thinnes
d73c86df3f Merge remote-tracking branch 'origin/main' into dylan-lf-15-minimal-distinguish-guards 2022-08-24 16:35:31 +01:00
Dylan Thinnes
9a83d0776e Exclude via $cexerciseGuarded check - ClassOpId approach did not work 2022-08-24 16:21:17 +01:00
Dylan Thinnes
b635dcd7cb Add check for isId to splitDFunId 2022-08-24 16:21:16 +01:00
Dylan Thinnes
dcfa1e0ebf Remove all instances of guarded exercises in versions <= 1.15 2022-08-24 16:21:16 +01:00
Dylan Thinnes
b0985ccdbd Remove guarded exercise when Extended Interfaces are not enabled 2022-08-24 16:21:16 +01:00
Dylan Thinnes
125280ca60 Clarify purpose of Maybe Expr type for exercise guard
Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-08-24 16:21:16 +01:00
Dylan Thinnes
50cff3004b Remove unnecessary mention of v1_14 from supportedInputVersions
Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-08-24 16:21:16 +01:00
Dylan Thinnes
89744ef341 Rename interface features
Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-08-24 16:21:16 +01:00
Dylan Thinnes
c173799c47 Attach correct range to guard support error (if any)
Co-Authored-By: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-08-24 16:21:16 +01:00
Dylan Thinnes
d9dfe87252 Desugar UExerciseInterface[Guarded] differently, point to updated GHC 2022-08-24 16:21:16 +01:00
Dylan Thinnes
dd0ac96dcd Make exercise guards nullable, ignore Nothing in decode/encode 2022-08-24 16:21:16 +01:00
dylant-da
a74c020ddd
Add version 1.15 - move interfaces into them (#14770)
* Add version 1.15 - move interfaces into them

* Update Ast/Version & docs for 1.15, split interface into simple/extended

* Stage 1.15 protobuf

* Remove references to dev from 1.15 protobufs

* Add Tests file for 1.15 in ledger API testtool

* Update Version 1.15 changelog with Call/implements

* Make 1.14 default again

* Add 1.15 as preview version

* Add 1.15 test suite to testtool

* Reinclude 1.15 in COMPILER_LF_VERSIONS to build model-tests-1.15

* Move v1_15 ledger-api-tests into own suite

* Fix InterfaceNotSupported message to 1.15 or higher

* satisfy changelog check

CHANGELOG_BEGIN
CHANGELOG_END

* Update tests with extended interface features to only run on 1.dev

* Allow unsafe_from_interface and interface_template_type_rep in 1.15

* Fix StableVersions back to 1.14, make EarlyAccessVersions 1.15

* Run retroactive implements tests only in extended interfaces

* lint

* Temporarily disable 1.15 conformance tests - handle in another PR

* Also disable conformance-test-tls1.2-or-newer-1.15

* Disable PureConfigReaderWriter tests that assume early-access == stable

* lint
2022-08-23 13:39:16 +00:00
Dylan Thinnes
ceaca2b0f6 Merge remote-tracking branch 'origin/main' into dylan-lf-15-minimal 2022-08-22 16:12:43 +01:00
Dylan Thinnes
65531fe577 Run retroactive implements tests only in extended interfaces 2022-08-22 11:00:52 +01:00
Dylan Thinnes
ff7271de1a Update tests with extended interface features to only run on 1.dev 2022-08-19 17:38:13 +01:00
Dylan Thinnes
337cc25b7a Fix InterfaceNotSupported message to 1.15 or higher 2022-08-19 16:45:23 +01:00
Dylan Thinnes
f5c48ddc99 Make 1.14 default again 2022-08-19 14:43:12 +01:00
Dylan Thinnes
196fa6a3cf Update Ast/Version & docs for 1.15, split interface into simple/extended 2022-08-19 14:00:27 +01:00
Dylan Thinnes
1c58421f2d Add version 1.15 - move interfaces into them 2022-08-19 13:52:23 +01:00
Moisés Ackerman
0d364f5547
update interface keywords in daml studio syntax file (#14759)
changelog_begin
changelog_end
2022-08-19 11:02:15 +02:00
Matteo Limberto
04c7f04da4
daml-doc generates valid rst for interface methods (#14752)
changelog_begin
changelog_end
2022-08-18 18:25:12 +02:00
Moisés Ackerman
ed046a11b5
Pretty print interfaces (#14742)
* Pretty print interface instances in templates

* Pretty print interface definitions, including nested interface instances

changelog_begin
changelog_end
2022-08-18 10:42:01 +02:00
Moisés Ackerman
009c3c306b
Add interface instance syntax, including retroactive interface instances (#14715)
* Extract qualifyLocally in LFConversion

* Update ghc rev

* Add parent type argument to interface instance desugaring types

* Check interface instance parent in LFConversion

* Convert interface instances in interface declarations

* Update daml-test-files to use 'interface instance' syntax

* Update other tests to use 'interface instance' syntax

* Update interface reference docs to use 'interface instance' syntax

* Update other files to use 'interface instance' syntax

* Add todo in DA.Daml.LF.Ast.Pretty

* Add daml-test-files for retroactive interface instances

changelog_begin
changelog_end
2022-08-17 12:06:59 +00:00
Moisés Ackerman
14c6f82ba2
DA.Internal.Interface.view now works directly on interface values (#14726)
changelog_begin
changelog_end
2022-08-17 11:05:44 +02:00
Moisés Ackerman
ad2740498b
Interface instance typechecking (haskell) (#14683)
* Remove -XRankNTypes in DA.Daml.LF.TypeChecker.Check

* Add TemplateOrInterface type in Haskell

* Define type InterfaceInstanceHead in daml-lf-ast

* Define 'lookupInterfaceInstance'

* Use lookupInterfaceInstance for checking implemented interfaces

* Use lookupInterfaceInstance for checking required interfaces

* Extract checkInterfaceInstance from checkIfaceImplementation

* Reword 'implements' errors in terms of interface instances

* Introduce tmplParam in checkInterfaceInstance

* Check interface instances in interface

* Add InterfacePart argument to ContextDefInterface

changelog_begin
changelog_end
2022-08-11 10:53:41 +00:00
Moritz Kiefer
f03615657a
Add insertWith to DA.Map (#14691)
changelog_begin

- [Daml Stdlib] Add `insertWith` to `DA.Map` which allows combining
  the newly inserted value with the existing value (if any).

changelog_end
2022-08-11 10:07:51 +00:00
dylant-da
0d37134bc2
Change placeholder unit viewtypes to empty records (#14656)
* Update views in integration-v1dev to be EmptyInterfaceView instead of ()

* Update expected desugared daml for `EmptyInterfaceView`

* Update compiler Shake / DataDependencies viewtypes to EmptyInterfaceView

* Add record viewtypes to docs, update docs

* Add empty records to daml-lf, language-support, ledger, trigger tests

* Qualify EmptyInterfaceView in ledger semantic Interface tests

* Fix imports for EmptyInterfaceView in IIou / CIou / Transferrable

* empty changelog commit

CHANGELOG_BEGIN
CHANGELOG_END

* Qualify EmptyInterfaceView import

* Fix imports of EmptyInterfaceView in TypeScript codegen tests

* Accept Interface doc changes

* Add EmptyInterfaceView to DataDependencies tests

* Remove missing interface viewtype test - all interfaces must have views

* Replace all EmptyInterfaceView with EmptyInterfaceView {}
2022-08-10 16:45:23 +00:00
dylant-da
b73e852604
Better errors related to Interface Views (#14648)
* Point to new GHC with errors for missing views

* Add placeholder view to ImplementsNonInterface

* Fix doc comment in InterfaceViewNotSpecified

* Add test for error when method named `view` is declared

* Add placeholder unit viewtype to doc tests

* Update err message in ImplementsNonInterface - error now detected in LF

* empty changelog commit

CHANGELOG_BEGIN
CHANGELOG_END
2022-08-10 13:45:25 +00:00
Moisés Ackerman
24e04076da
Refactor interface LF conversion (#14671)
* Extract interface views from binds instead of 'md_insts'

* Extract interface binds together

* Define and use pattern 'HasMethodDFunId' to extract 'HasMethod' instances

* Extract interface methods in 'scrapeInterfaceBinds'

* Extract interface requirements in 'scrapeInterfaceBinds'

* Include locations in InterfaceBinds.ibMethods

* Introduce 'InterfaceInstanceGroup' newtype

* Extract interface instance binds together in 'scrapeInterfaceInstanceBinds'

* Extract 'convertInterfaceInstance' from 'convertImplements'

* Update expected error in daml-test-file ImplementsNonInterface

changelog_begin
changelog_end
2022-08-10 11:46:21 +02:00
Carl Pulley
19a2b986bc
Disclosure testing invalid contract type
* Test that invalidly typed contracts are rejected

CHANGLELOG_BEGIN

* Engine/speedy-level tests for explicit disclosure (#14227): test that invalidly typed contracts are rejected.

CHANGELOG_END
2022-08-09 18:45:44 +01:00
dylant-da
a4e29299be
Implement Interface views in speedy (#14565)
* Add DA_Internal_Interface to convertTypeDef exclusion check

* Move desugared types/values for interface views into DA.Internal.Desugar

* Convert viewtype and view method declarations

* Typecheck view types and view declarations

* Add unit viewtypes to InterfaceChoiceCollision tests

* Add unit viewtypes to more compiler/damlc tests

* Modify empty interfaces/implements to have viewtypes/views

* Add unit viewtypes to remaining Interface tests

* Test for error thrown when viewtype not specified

* Fix daml-lf/ interface tests to use new syntax / unit views

* Add placeholder view of type Unit to TestInterfaces

CHANGELOG_BEGIN
CHANGELOG_END

* Fix typescript interface tests with unit viewtype

* Add unit viewtype to Java & Scala codegen

* Add unit viewtype to triggers tests interface

* Add unit viewtypes to ledger/test-common

* Add unit viewtypes to ledger-service/http-json

* Fix some damlc tests

* Use viewtype syntax in InterfaceViewNonSerializable test

* Remove HasInferfaceView instances in convertBind

* Add unit view to QualifiedInterface.daml test

* Generate HasInterfaceView instances in DataDependencies

* Add unit viewtypes and views to compiler/damlc/tests

* Document reconstruction of HasInterfaceView

* Move desugared types/values for interface views into DA.Internal.Desugar

* Add desugarable function view w/ EViewInterface desugaring

* Remove templateName and viewtype from generated EViewInterface

* Update desugared-daml

* Proof of concept: use _view -> EViewInterface prim via HasInterfaceView

* Move view, HasInterfaceView to DA.Internal.Interface

* Update desugared-daml tests

* Stop removing and re-generating HasInterfaceView instances

* Do not generate docs for generated "_view_" methods

* Report errors with interface TypeConNames prettily

* Fix InterfaceViewNotSpecified @ERROR to reflect new error text

* Don't import magic `view` method from Prelude to avoid name clash

* Update shake interface goto definition test locations

* Temp disable view spec tests, will re-implement views in speedy

* Add unit viewtype to Java code snippet docs

* Update Interface syntax docs for views

* Add unit viewtype to Transferrable.daml

* Add back "empty" interface implementation to interfaces.rst

* Re-enable view tests by having _view methods on InterfaceViews.daml file

* Remove deprecated commented-out view desugaring code

* Remove templateId and viewtype from EViewInterface

* Fix lint

* Compile DefRefs for views, return them in SBViewInterface

* Stop looking for `_view` method, remove ENoViewFound in TypeChecker.hs

* Remove ENoViewFound / remove view method lookup, use view param instead

* Fix use of viewMethod.returnType / import of MethodName

* Replace uses of `_view` in Scala, update parser w/ viewtype/view clauses

* Fix lint

* Update Interface LF encoding test for views

* Stop using unit views in ParsersSpec

* Fix tests to have new Scala test parser viewtype/view syntax

* Fix Interface_extended_1.dev_.lf to have viewtypes/views

* Change all spec/lf viewtypes/views to Unit

* Remove accidental use of requires

* Fix ParsersSpec to have record viewtypes/views

* Fix ValueEnricherSpec for switch to unit views

* Remove no view test from Scala - lack of view is caught at compile-time

* Remove unused _view method in InterfaceViews.daml test

* Return control expression via Control.Expression

* Retrieve compiled views via implementation body
2022-08-09 12:49:14 +01:00
Moisés Ackerman
c146bee87d
Reduce duplication between implements and co-implements (#14607)
* Reduce duplication between implements and co-implements

This extracts the common part (methods and view) to a new type InterfaceInstanceBody

changelog_begin
changelog_end
2022-08-04 17:01:15 +02:00
Carl Pulley
d0f40d89ca
Disclosure error reporting fix
Add key hash to scenario service error reporting

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): Add key hash to scenario service error reporting.

CHANGELOG_END
2022-08-04 11:09:33 +01:00
Moisés Ackerman
aa01362dca
data-dependencies: empty class instances (#14600)
* data-dependencies: accept Unit as a valid dfun body

changelog_begin
* data-dependencies: fixed a bug in the handling of instances of typeclasses without methods (#14585)
changelog_end
2022-08-04 10:03:14 +02:00
dylant-da
8e8e0dabdf
Convert viewtype and view methods to LF (#14456)
* Add DA_Internal_Interface to convertTypeDef exclusion check

* Move desugared types/values for interface views into DA.Internal.Desugar

* Convert viewtype and view method declarations

* Typecheck view types and view declarations

* Add unit viewtypes to InterfaceChoiceCollision tests

* Add unit viewtypes to more compiler/damlc tests

* Modify empty interfaces/implements to have viewtypes/views

* Add unit viewtypes to remaining Interface tests

* Test for error thrown when viewtype not specified

* Fix daml-lf/ interface tests to use new syntax / unit views

* Add placeholder view of type Unit to TestInterfaces

CHANGELOG_BEGIN
CHANGELOG_END

* Fix typescript interface tests with unit viewtype

* Add unit viewtype to Java & Scala codegen

* Add unit viewtype to triggers tests interface

* Add unit viewtypes to ledger/test-common

* Add unit viewtypes to ledger-service/http-json

* Fix some damlc tests

* Use viewtype syntax in InterfaceViewNonSerializable test

* Remove HasInferfaceView instances in convertBind

* Add unit view to QualifiedInterface.daml test

* Generate HasInterfaceView instances in DataDependencies

* Add unit viewtypes and views to compiler/damlc/tests

* Document reconstruction of HasInterfaceView

* Move desugared types/values for interface views into DA.Internal.Desugar

* Add desugarable function view w/ EViewInterface desugaring

* Remove templateName and viewtype from generated EViewInterface

* Update desugared-daml

* Proof of concept: use _view -> EViewInterface prim via HasInterfaceView

* Move view, HasInterfaceView to DA.Internal.Interface

* Update desugared-daml tests

* Stop removing and re-generating HasInterfaceView instances

* Do not generate docs for generated "_view_" methods

* Report errors with interface TypeConNames prettily

* Fix InterfaceViewNotSpecified @ERROR to reflect new error text

* Don't import magic `view` method from Prelude to avoid name clash

* Update shake interface goto definition test locations

* Temp disable view spec tests, will re-implement views in speedy

* Add unit viewtype to Java code snippet docs

* Update Interface syntax docs for views

* Add unit viewtype to Transferrable.daml

* Add back "empty" interface implementation to interfaces.rst

* Re-enable view tests by having _view methods on InterfaceViews.daml file

* Remove deprecated commented-out view desugaring code
2022-08-03 16:23:38 +01:00
Moisés Ackerman
0c8f2ed43e
LF conversion: split Env (#14566)
* LF conversion: split Env type into Env+ModuleContents

Env is now limited to information _about_ the module and the compilation environment, as well as compiler state such as local aliases and a fresh tyvar name supply
ModuleContents has the fields from old Env which are extracted from type, class and function declarations in the module being converted

* rename x=>coreModule

* Extract convertBinds function

* Extract convertTypeDefs function

* move binds into ModuleContents

* Move typeDefs into ModuleContents

* Move depOrphanModules into ModuleContents

* Move exports into ModuleContents

* Move fixities into ModuleContents

* Extract mkEnv function

* Extract convertModuleContents function

* Remove unused fields {Env,DamlEnv}.envIsGenerated

* Remove unused field ModuleContents.mcInterfaceChoiceData

* Remove unused field ModuleContents.mcInterfaceBinds

changelog_begin
changelog_end
2022-07-29 09:15:26 +02:00
Remy
b163638d19
Damlc: Remove precondition for interface (#14548)
* Damlc: Remove precondition for interfaces

follow up of #14511, goes together with digital-asset/ghc#129

* Address Ackerman's review

* Update ghc rev

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-28 16:34:12 +00:00
Carl Pulley
c87732c438
Disclosure testing of contracts and keys
* Basic explicit disclosure testing

CHANGELOG_BEGIN

  * Engine/speedy-level tests for explicit disclosure (#14227): test that explicit disclosure works for contracts and keys.

CHANGELOG_END
2022-07-28 16:00:55 +01:00
Remy
88d4ff93f2
LF: remove precondition in interface (proto & scala side) (#14511)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-27 10:52:35 +02:00
dylant-da
87938faaf7
DAML Views - Syntax Only (#14435)
* Point to new GHC version with viewtype and view syntax

* Make minimum modifications to erase newly generated view code

CHANGELOG_BEGIN
CHANGELOG_END

* Point to updated GHC - no longer requires viewtype/view at syntax level

* Add DA_Internal_Interface to convertTypeDef exclusion check

* Move desugared types/values for interface views into DA.Internal.Desugar

* Disable unused TypeFamilies extension in DA.Internal.Interface

* Point to updated GHC, "Remove shortViewName"

* Update to latest GHc view syntax changes

* Update GHC to merged view syntax changes
2022-07-26 16:57:51 +00:00
Johan Sjödin
3968bcf216
Fix DA.Logic.isBool comment (#14532)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-26 15:20:40 +00:00
Remy
8a02a050b1
LF: Remove interface methods from collision check (#14513)
CHANGELOG_BEGIN
CHANGELOG_END
2022-07-26 13:31:55 +02:00
dylant-da
8d93efdd12
Add EViewInterface to LF - stub compilation/interpretation in speedy (#14486)
* Add ViewInterface to LF - stub interpretation in speedy

* Remove templateId and viewtype from EViewInterface

* Fix lint
2022-07-21 15:10:53 +00:00
dylant-da
ab948dd8de
Update LF AST protobuf for interface viewtype and implementation view (#14439)
* Update protobuf to include viewtype and implementation view

* Stub interface viewtype and implements view in updated AST

* Set views on Java builders in DecodeV1Spec

CHANGELOG_BEGIN
Update LF AST protobuf for interface viewtype and implementation view -
not currently linked to syntax or engine changes, all stubbed out in
LFConversion.
CHANGELOG_END

* Add view field to CoImplements

* Update iterators & parsers to account for CoImplements view

* Replace uses of TBuiltin(BTUnit) with TUnit

* Remove superfluous "Available in versions >= 1.dev" comment

* Fix missing TUnit imports, missing view param in daml-lf/parser

* Remove unused imports from DecodeV1Spec

* Add stub view in AstSpec
2022-07-19 12:00:04 +00:00
Moisés Ackerman
2393b5071f
Reject class method overlapping with record field (#14391)
* Update GHC patch

* Add daml-test-files for overlapping methods and fields

* changelog

changelog_begin
* [daml] Programs where a class method overlaps with a record field are no longer accepted (#14390)
changelog_end
2022-07-11 12:58:20 +00:00
dylant-da
3c7ab41bc3
Check interface view exists and is serializable, in compiler and in engine (#14112) (#14322)
CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-07-05 13:43:28 +00:00
Remy
abd47e972b
[Speedy] Do not crash when encountering an inconsistent contract key (#14276)
but rather return a proper interpretation error.

CHANGELOG_BEGIN
CHANGELOG_END
2022-07-05 10:28:38 +00:00