forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove DA.Experimental.Interfaces (digital-asset#12619)
The functions are available through typeclasses / typeclass instances generated during desugaring. Moved the test over to use these, and discovered a bug in our implementation of `observer`. changelog_begin changelog_end
- Loading branch information
1 parent
5810c25
commit f5c9a67
Showing
5 changed files
with
42 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
compiler/damlc/daml-stdlib-src/DA/Experimental/Interface.daml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 0 additions & 105 deletions
105
compiler/damlc/tests/daml-test-files/InterfaceExperimental.daml
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
compiler/damlc/tests/daml-test-files/InterfaceFunctions.daml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
-- @SINCE-LF-FEATURE DAML_INTERFACE | ||
-- | Check that `create`, `signatory`, `observer`, `interfaceTypeRep` work as expected on interface payloads. | ||
module InterfaceFunctions where | ||
|
||
import DA.Assert ((===)) | ||
|
||
interface Token where | ||
getAmount : Int | ||
|
||
template Asset | ||
with | ||
issuer : Party | ||
owner : Party | ||
amount : Int | ||
where | ||
signatory issuer | ||
observer issuer, owner | ||
implements Token where | ||
let getAmount = amount | ||
|
||
main = scenario do | ||
alice <- getParty "Alice" | ||
bob <- getParty "Bob" | ||
let asset = Asset alice bob 15 | ||
let token = toInterface @Token asset | ||
fromInterface token === Some asset | ||
getAmount token === 15 | ||
submit alice do | ||
cid <- create token | ||
token' <- fetch cid | ||
fromInterface token' === Some asset | ||
getAmount token' === 15 | ||
signatory token === [alice] | ||
observer token === [bob, alice] | ||
assert (TemplateTypeRep (interfaceTypeRep token) == templateTypeRep @Asset) | ||
assert (TemplateTypeRep (interfaceTypeRep token) /= templateTypeRep @Token) | ||
|
||
-- @ENABLE-SCENARIOS |