daml/daml-lf/tests/Interfaces.daml
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

58 lines
1.3 KiB
Haskell

-- Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module Interfaces where
data EmptyInterfaceView = EmptyInterfaceView {}
interface I1 where
viewtype EmptyInterfaceView
getOwner1 : Party
choice C1 : ()
controller getOwner1 this
do pure ()
interface I2 where
viewtype EmptyInterfaceView
getOwner2 : Party
choice C2 : ()
controller getOwner2 this
do pure ()
interface I3 requires I4 where
viewtype EmptyInterfaceView
interface I4 where
viewtype EmptyInterfaceView
getOwner4 : Party
choice C4 : ()
controller getOwner4 this
do pure ()
template T1
with
owner1 : Party
where
signatory owner1
interface instance I1 for T1 where
view = EmptyInterfaceView
getOwner1 = owner1
choice OwnChoice : ()
controller owner1
do pure ()
template T2
with
owner2 : Party
where
signatory owner2
interface instance I1 for T2 where
view = EmptyInterfaceView
getOwner1 = owner2
interface instance I2 for T2 where
view = EmptyInterfaceView
getOwner2 = owner2
interface instance I4 for T2 where
view = EmptyInterfaceView
getOwner4 = owner2