Skip to content

Commit

Permalink
ifaces: update ghc-parser (#11383)
Browse files Browse the repository at this point in the history
* ifaces: update ghc-parser

This updates the ghc-parser, including the `ifaceTypeRep` method
generation for interfaces.

CHANGELOG_BEGIN
CHANGELOG_END

* pin stack snapshot on unix

* add tests

* update ghc-lib hash

* pin stackage dependencies on unix

* pinned stackage windows
  • Loading branch information
Robin Krom authored Oct 27, 2021
1 parent 503e391 commit 12e782b
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ci/da-ghc-lib/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
variables:
ghc-lib-sha: '42e5c306dcfbc84b83336fdd531023e93bfcc5b2'
base-sha: '9c787d4d24f2b515934c8503ee2bbd7cfac4da20'
patches: '9fcd347e46790d0d054c347de7d36303426ee173 833ca63be2ab14871874ccb6974921e8952802e9'
patches: '1acb39102edff7f9f81e50769b159aad458d40e9 833ca63be2ab14871874ccb6974921e8952802e9'
flavor: 'ghc-8.8.1'
steps:
- checkout: self
Expand Down
1 change: 1 addition & 0 deletions compiler/damlc/daml-stdlib-src/DA/Internal/Desugar.daml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module DA.Internal.Desugar (
Party, ContractId, Update, Any,
NonConsuming(..), PreConsuming(..), PostConsuming(..), Consuming(..),
Implements(..),
TypeRep,
) where

import DA.Internal.Prelude
Expand Down
5 changes: 5 additions & 0 deletions compiler/damlc/tests/daml-test-files/InterfaceDesugared.daml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
module InterfaceDesugared where

import DA.Assert ((===))
import DA.Action (unless)

data Split = Split { splitAmount : Int }

Expand All @@ -28,6 +29,7 @@ class
fromToken : Token -> Optional t
toTokenContractId : ContractId t -> ContractId Token
fromTokenContractId : ContractId Token -> Update (Optional (ContractId t))
tokenTypeRep : t -> DA.Internal.Desugar.TypeRep
getOwner : t -> Party
getAmount : t -> Int
setAmount : t -> Int -> Token
Expand Down Expand Up @@ -56,6 +58,7 @@ instance IsToken Token where
fromToken = GHC.Types.primitive @"EFromInterface"
toTokenContractId = GHC.Types.primitive @"EToInterfaceContractId"
fromTokenContractId = GHC.Types.primitive @"UFromInterfaceContractId"
tokenTypeRep = GHC.Types.primitive @"$TO_TYPE_REP"
getOwner = GHC.Types.primitiveInterface @"getOwner"
getAmount = GHC.Types.primitiveInterface @"getAmount"
setAmount = GHC.Types.primitiveInterface @"setAmount"
Expand Down Expand Up @@ -114,6 +117,7 @@ instance IsToken Asset where
fromToken = GHC.Types.primitive @"EFromInterface"
toTokenContractId = GHC.Types.primitive @"EToInterfaceContractId"
fromTokenContractId = GHC.Types.primitive @"UFromInterfaceContractId"
tokenTypeRep = GHC.Types.primitive @"$TO_TYPE_REP"
getOwner Asset{..} = owner
getAmount Asset{..} = amount
setAmount this x = toToken (this with amount = x)
Expand Down Expand Up @@ -242,5 +246,6 @@ main = scenario do
None -> abort "expected Asset"
Some Asset {amount} ->
amount === 25
unless (tokenTypeRep token3 == tokenTypeRep token4) $ error "Type representations are different."

pure ()
28 changes: 26 additions & 2 deletions compiler/damlc/tests/daml-test-files/InterfaceExperimental.daml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ template NotAsset
where
signatory p

implements Token where
let getAmount = error "getAmount"

choice Split : (ContractId Token, ContractId Token)
with
splitAmount : Int
controller p
do
error "Split"

choice Transfer : ContractId Token
with
newOwner : Party
controller p
do
error "Transfer"

nonconsuming choice Noop : ()
with
nothing : ()
controller p
do
error "Noop"

main = scenario do
alice <- getParty "Alice"
bob <- getParty "Bob"
Expand All @@ -79,6 +103,6 @@ main = scenario do
interfaceCreate token
interfaceSignatory token === [alice]
interfaceObserver token === [bob, alice]
unless (toTypeRep token == toTypeRep asset) $ abort "TypeReps are not equal"
unless (toTypeRep token /= toTypeRep notAsset) $ abort "TypeReps are equal"
unless (tokenTypeRep token == tokenTypeRep asset) $ abort "TypeReps are not equal"
unless (tokenTypeRep token /= tokenTypeRep notAsset) $ abort "TypeReps are equal"
pure ()
8 changes: 4 additions & 4 deletions stack-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

resolver: lts-18.0
packages:
- archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-f5ac369874d523562066264f7facc06b.tar.gz
sha256: "ac7f2f212f1b1d69f107664059292133a08eabf6550b05371432216718460647"
- archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-f5ac369874d523562066264f7facc06b.tar.gz
sha256: "99b90740b5c17574ed5fc7df8d3449e35bf614bd9d3fda2515ac90c2f389cbdb"
- archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-43279e015863803ef18d90d62689a4d2.tar.gz
sha256: "b26f5e9195010d66ae402d3143efd3a321934eb3c1d94fc8e695ed1d18fa875c"
- archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-43279e015863803ef18d90d62689a4d2.tar.gz
sha256: "11cf7fbaad554da3d33589f2985c01e5469684a26be926f8342668e88f61505b"
- github: digital-asset/hlint
commit: "c8246c1feb932858ff2b5d7e9e900068a974bf57"
sha256: "3da24baf789c5f00211a92e24153e6b88102befaa946ada1f707935554500fe2"
Expand Down
10 changes: 5 additions & 5 deletions stackage_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": 1812030934,
"all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/0f926aa83a735a25f4396220d752211f65aa6764",
"__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": -423766253,
"all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/4a5f01d3d79b421883d720dc7e7aff3d6dae5a9c",
"resolved": {
"Cabal": {"dependencies":[],"location":{"type":"core"},"name":"Cabal","version":"3.2.1.0"},
"Decimal": {"dependencies":["base","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/Decimal-0.5.2/Decimal-0.5.2.tar.gz"},"name":"Decimal","pinned":{"url":["https://hackage.haskell.org/package/Decimal-0.5.2/Decimal-0.5.2.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/Decimal-0.5.2.tar.gz"],"sha256":"a37a0220424e4bcb8cae1d38844c7027ee314449758d0d14ff3e2e0a5c8a87a7","cabal-sha256":"83dd16a1c0737fd35fdb1088af36e1a53034e75090e3f0d4ad32296f1a35a13b"},"version":"0.5.2"},
Expand Down Expand Up @@ -100,8 +100,8 @@
"generic-deriving": {"dependencies":["base","containers","ghc-prim","template-haskell","th-abstraction"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/generic-deriving-1.14/generic-deriving-1.14.tar.gz"},"name":"generic-deriving","pinned":{"url":["https://hackage.haskell.org/package/generic-deriving-1.14/generic-deriving-1.14.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/generic-deriving-1.14.tar.gz"],"sha256":"d0abd5e423960b66867c6149c20b221b1351e3805d1bf787fc4efa3e7bb7cb02","cabal-sha256":"c9c6782a3cdce2f2bcaf891e0ffbf06df871e68498574b73a565771dc084273c"},"version":"1.14"},
"generics-sop": {"dependencies":["base","ghc-prim","sop-core","template-haskell","th-abstraction"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/generics-sop-0.5.1.1/generics-sop-0.5.1.1.tar.gz"},"name":"generics-sop","pinned":{"url":["https://hackage.haskell.org/package/generics-sop-0.5.1.1/generics-sop-0.5.1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/generics-sop-0.5.1.1.tar.gz"],"sha256":"81b7c38b5c2a1ae3c790b1707a0e2a2031430e33b3683f88e2daa5b59ae4c5d8","cabal-sha256":"522a1a1da05d5acc03da448fa603c038cc15b991272846a591e26e7505d2b73a"},"version":"0.5.1.1"},
"ghc-byteorder": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ghc-byteorder-4.11.0.0.10/ghc-byteorder-4.11.0.0.10.tar.gz"},"name":"ghc-byteorder","pinned":{"url":["https://hackage.haskell.org/package/ghc-byteorder-4.11.0.0.10/ghc-byteorder-4.11.0.0.10.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-byteorder-4.11.0.0.10.tar.gz"],"sha256":"86e50a89798181db4f44ec3848fc52940c73098e88549a351ceb54fefc691fb6","cabal-sha256":"d47fdef63f2a145091e91b1aedbd46bf61ca03bb935e81e3462a1d904c319de3"},"version":"4.11.0.0.10"},
"ghc-lib": {"dependencies":["alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-lib-parser","ghc-prim","happy","hpc","pretty","process","rts","time","transformers","unix"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-f5ac369874d523562066264f7facc06b.tar.gz"},"name":"ghc-lib","pinned":{"sha256":"ac7f2f212f1b1d69f107664059292133a08eabf6550b05371432216718460647","strip-prefix":"ghc-lib-8.8.1.20211020"},"version":"8.8.1.20211020"},
"ghc-lib-parser": {"dependencies":["alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-prim","happy","hpc","pretty","process","time","transformers","unix"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-f5ac369874d523562066264f7facc06b.tar.gz"},"name":"ghc-lib-parser","pinned":{"sha256":"99b90740b5c17574ed5fc7df8d3449e35bf614bd9d3fda2515ac90c2f389cbdb","strip-prefix":"ghc-lib-parser-8.8.1.20211020"},"version":"8.8.1.20211020"},
"ghc-lib": {"dependencies":["alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-lib-parser","ghc-prim","happy","hpc","pretty","process","rts","time","transformers","unix"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-43279e015863803ef18d90d62689a4d2.tar.gz"},"name":"ghc-lib","pinned":{"sha256":"b26f5e9195010d66ae402d3143efd3a321934eb3c1d94fc8e695ed1d18fa875c","strip-prefix":"ghc-lib-8.8.1.20211026"},"version":"8.8.1.20211026"},
"ghc-lib-parser": {"dependencies":["alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-prim","happy","hpc","pretty","process","time","transformers","unix"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-43279e015863803ef18d90d62689a4d2.tar.gz"},"name":"ghc-lib-parser","pinned":{"sha256":"11cf7fbaad554da3d33589f2985c01e5469684a26be926f8342668e88f61505b","strip-prefix":"ghc-lib-parser-8.8.1.20211026"},"version":"8.8.1.20211026"},
"ghc-lib-parser-ex": {"dependencies":["base","bytestring","containers","extra","ghc-lib-parser","uniplate"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ghc-lib-parser-ex-8.8.5.8/ghc-lib-parser-ex-8.8.5.8.tar.gz"},"name":"ghc-lib-parser-ex","pinned":{"url":["https://hackage.haskell.org/package/ghc-lib-parser-ex-8.8.5.8/ghc-lib-parser-ex-8.8.5.8.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-lib-parser-ex-8.8.5.8.tar.gz"],"sha256":"b36ef8b49da4e8c78b00dca9b9546b7d4db0b09b10da5e313d3f0dbb4af581d7","cabal-sha256":"04f164fd6a4a5b0c5627cf7fadd79174c3b1d4c696dc481a9909266bd6a2a6aa"},"version":"8.8.5.8"},
"ghc-prim": {"dependencies":[],"location":{"type":"core"},"name":"ghc-prim","version":"0.6.1"},
"ghcide": {"dependencies":["aeson","async","base","binary","bytestring","containers","data-default","deepseq","dependent-map","dependent-sum","directory","extra","filepath","fuzzy","ghc-lib","ghc-lib-parser","haddock-library","hashable","hslogger","lsp","lsp-types","mtl","network-uri","prettyprinter","prettyprinter-ansi-terminal","regex-tdfa","rope-utf16-splay","safe-exceptions","shake","some","sorted-list","stm","syb","text","time","transformers","unix","unliftio","unordered-containers","utf8-string"],"location":{"type":"vendored"},"name":"ghcide","version":"0.1.0"},
Expand All @@ -113,7 +113,7 @@
"hashable": {"dependencies":["base","bytestring","deepseq","ghc-prim","integer-simple","text"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/hashable-1.3.0.0/hashable-1.3.0.0.tar.gz"},"name":"hashable","pinned":{"url":["https://hackage.haskell.org/package/hashable-1.3.0.0/hashable-1.3.0.0.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/hashable-1.3.0.0.tar.gz"],"sha256":"822e5413fbccca6ae884d3aba4066422c8b5d58d23d18b9ecb5c03273bb19ab4","cabal-sha256":"d60cad00223d46172020c136e68acef0481a47d0302b2e74b1805b4f3a446a9b"},"version":"1.3.0.0"},
"haskeline": {"dependencies":["base","bytestring","containers","directory","exceptions","filepath","process","stm","terminfo","transformers","unix"],"location":{"type":"core"},"name":"haskeline","version":"0.8.1.2"},
"haskell-lexer": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/haskell-lexer-1.1/haskell-lexer-1.1.tar.gz"},"name":"haskell-lexer","pinned":{"url":["https://hackage.haskell.org/package/haskell-lexer-1.1/haskell-lexer-1.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/haskell-lexer-1.1.tar.gz"],"sha256":"313a15cc643322c8badd148867ce25ca1ffc191df9e7eeec5b10bc08c4b563d5","cabal-sha256":"9e0a7633f6bdb59004c6f3144ebfad1edb9e440fc6a94215c3a1d11bcd8656ef"},"version":"1.1"},
"haskell-src": {"dependencies":["array","base","happy","pretty","syb"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/haskell-src-1.0.3.1/haskell-src-1.0.3.1.tar.gz"},"name":"haskell-src","pinned":{"url":["https://hackage.haskell.org/package/haskell-src-1.0.3.1/haskell-src-1.0.3.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/haskell-src-1.0.3.1.tar.gz"],"sha256":"869cc710004c2161470d8a788dab96d2cff054fa106c301be6689109f57e5132","cabal-sha256":"ec2661fd7515577d0547460412634fbfcdd0c493809105703dff53760e6fd833"},"version":"1.0.3.1"},
"haskell-src": {"dependencies":["array","base","happy","pretty","syb"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/haskell-src-1.0.3.1/haskell-src-1.0.3.1.tar.gz"},"name":"haskell-src","pinned":{"url":["https://hackage.haskell.org/package/haskell-src-1.0.3.1/haskell-src-1.0.3.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/haskell-src-1.0.3.1.tar.gz"],"sha256":"869cc710004c2161470d8a788dab96d2cff054fa106c301be6689109f57e5132","cabal-sha256":"4ccc5680c692e3eb2d59d5ca57f2779ec703e9505d435a221bebebb0c25d51e1"},"version":"1.0.3.1"},
"haskell-src-exts": {"dependencies":["array","base","ghc-prim","happy","pretty"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/haskell-src-exts-1.23.1/haskell-src-exts-1.23.1.tar.gz"},"name":"haskell-src-exts","pinned":{"url":["https://hackage.haskell.org/package/haskell-src-exts-1.23.1/haskell-src-exts-1.23.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/haskell-src-exts-1.23.1.tar.gz"],"sha256":"67853047169fff7d3e5d87acef214ee185a6ab8c6a104ed9c59e389574cf6c05","cabal-sha256":"339841f4a6710e915a0bac8df18d8a454c11d626131aee4d05b6be150b7f863e"},"version":"1.23.1"},
"heaps": {"dependencies":["base"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/heaps-0.4/heaps-0.4.tar.gz"},"name":"heaps","pinned":{"url":["https://hackage.haskell.org/package/heaps-0.4/heaps-0.4.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/heaps-0.4.tar.gz"],"sha256":"89329df8b95ae99ef272e41e7a2d0fe2f1bb7eacfcc34bc01664414b33067cfd","cabal-sha256":"66b19fcd813b0e4db3e0bac541bd46606c3b13d3d081d9f9666f4be0f5ff14b8"},"version":"0.4"},
"hlint": {"dependencies":["aeson","ansi-terminal","base","bytestring","cmdargs","containers","cpphs","data-default","directory","extra","file-embed","filepath","filepattern","ghc-lib-parser","ghc-lib-parser-ex","hscolour","process","refact","text","transformers","uniplate","unordered-containers","utf8-string","vector","yaml"],"location":{"type":"archive","url":"https://github.com/digital-asset/hlint/archive/c8246c1feb932858ff2b5d7e9e900068a974bf57.tar.gz"},"name":"hlint","pinned":{"sha256":"3da24baf789c5f00211a92e24153e6b88102befaa946ada1f707935554500fe2","strip-prefix":"hlint-c8246c1feb932858ff2b5d7e9e900068a974bf57"},"version":"2.2.11"},
Expand Down
Loading

0 comments on commit 12e782b

Please sign in to comment.