From 0867605e1ab7678df3627e54208c5f485f2363e6 Mon Sep 17 00:00:00 2001 From: nickchapman-da <49153372+nickchapman-da@users.noreply.github.com> Date: Thu, 3 Dec 2020 15:08:02 +0000 Subject: [PATCH] Don't loose signatures in template let binding (#8136) * update ghc-lib patch * update stack-snapshot.yaml changelog_begin changelog_end * bazel run @stackage-unpinned//:pin (on linux) and update stackage_snapshot.json * testcase to check type signatures in template-lets are not ignored * update to ghc-lib commit hash following merge * update snapshot * update snapshot after pin on windows * update stack pin on linux Co-authored-by: Nick Chapman --- ci/da-ghc-lib/compile.yml | 2 +- .../TemplateLetWithSignatures.daml | 28 +++++++++++++++++++ stack-snapshot.yaml | 8 +++--- stackage_snapshot.json | 8 +++--- stackage_snapshot_windows.json | 8 +++--- 5 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 compiler/damlc/tests/daml-test-files/TemplateLetWithSignatures.daml diff --git a/ci/da-ghc-lib/compile.yml b/ci/da-ghc-lib/compile.yml index 6de38b2c93..6623f5bc51 100644 --- a/ci/da-ghc-lib/compile.yml +++ b/ci/da-ghc-lib/compile.yml @@ -12,7 +12,7 @@ jobs: variables: ghc-lib-sha: '77fcc42eef2256ba9bb61a7e442a65bedb19a35d' base-sha: '9c787d4d24f2b515934c8503ee2bbd7cfac4da20' - patches: '8b7ba525f1f327397ccae770af4f5973f53c7786 833ca63be2ab14871874ccb6974921e8952802e9' + patches: 'f41bf7627453acbd457766173820cabe60d7fad3 833ca63be2ab14871874ccb6974921e8952802e9' flavor: 'ghc-8.8.1' steps: - checkout: self diff --git a/compiler/damlc/tests/daml-test-files/TemplateLetWithSignatures.daml b/compiler/damlc/tests/daml-test-files/TemplateLetWithSignatures.daml new file mode 100644 index 0000000000..8f50244cd6 --- /dev/null +++ b/compiler/damlc/tests/daml-test-files/TemplateLetWithSignatures.daml @@ -0,0 +1,28 @@ +-- Copyright (c) 2020, Digital Asset (Switzerland) GmbH and/or its affiliates. +-- All rights reserved. + +module TemplateLetWithSignatures where + +-- This example should fail to type check. +-- There was a bug reported: https://github.com/digital-asset/daml/issues/7902 +-- which indicated that the signature was being ignored. +-- It is now not ignored, and the example does indeed fail to type check. + +-- TODO: only report the type error once, instead of 5 times! + +template T + with + p : Party + where + signatory p + let q : Int + q = p + choice C : () + controller q + do pure () + +-- @ERROR Couldn't match expected type ‘Int’ with actual type ‘Party’ +-- @ERROR Couldn't match expected type ‘Int’ with actual type ‘Party’ +-- @ERROR Couldn't match expected type ‘Int’ with actual type ‘Party’ +-- @ERROR Couldn't match expected type ‘Int’ with actual type ‘Party’ +-- @ERROR Couldn't match expected type ‘Int’ with actual type ‘Party’ diff --git a/stack-snapshot.yaml b/stack-snapshot.yaml index 324c752f0f..92e7200d73 100644 --- a/stack-snapshot.yaml +++ b/stack-snapshot.yaml @@ -3,10 +3,10 @@ resolver: lts-14.1 packages: - - archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-188559a1c65f9a4c19ac8e983ed79cd6.tar.gz - sha256: "5d73af2df22e55711500402d8d209ae9b5bf486120442cd2dceed6ba92e98756" - - archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-188559a1c65f9a4c19ac8e983ed79cd6.tar.gz - sha256: "4fd0a4d6d818b0e170d75061005fd0d4988288b3b26a3f07983f9971ee48a980" + - archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-086a06e8f84b5227e5f63b1dc01b768a.tar.gz + sha256: "9b7977a09120100b9be5aee0319b88a0cd232a60271b36efaa0a2f5ea7544621" + - archive: https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-086a06e8f84b5227e5f63b1dc01b768a.tar.gz + sha256: "714ddb325da3320ed7012cec7005f4f47a54cb9e6e4bed6817869c0eaf0306b2" - github: digital-asset/hlint commit: "3e78bce69749b22a80fec1e8eb853cc0c100c18e" sha256: "cf39f2b378485afc77ffdad4dbb057d5d9b4dfc5a38c76ddc44e920e537fb0fa" diff --git a/stackage_snapshot.json b/stackage_snapshot.json index d924ee1796..4942961f6c 100644 --- a/stackage_snapshot.json +++ b/stackage_snapshot.json @@ -1,6 +1,6 @@ { - "__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": -286311109, - "all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/ae12d9b008e12b50542ed592d789705eec52798a", + "__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": 993415215, + "all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/ddcf59b7f97123f20d0038f36e83a3c32ff204a5", "resolved": { "Cabal": {"dependencies":["array","base","binary","bytestring","containers","deepseq","directory","filepath","mtl","parsec","pretty","process","text","time","transformers","unix"],"location":{"type":"core"},"name":"Cabal","version":"2.4.1.0"}, "Decimal": {"dependencies":["base","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/Decimal-0.5.1/Decimal-0.5.1.tar.gz"},"name":"Decimal","pinned":{"url":["https://hackage.haskell.org/package/Decimal-0.5.1/Decimal-0.5.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/Decimal-0.5.1.tar.gz"],"sha256":"575ca5c65a8ea5a5bf2cd7b794a0d16622082cb501bf4b0327c5895c0b80f34c","cabal-sha256":"06bdd0f8badfb2104fd052f64888c283792a08f9a0d3661339e133e073080299"},"version":"0.5.1"}, @@ -94,8 +94,8 @@ "ghc": {"dependencies":[],"location":{"type":"core"},"name":"ghc","version":"8.6.5"}, "ghc-boot": {"dependencies":[],"location":{"type":"core"},"name":"ghc-boot","version":"8.6.5"}, "ghc-boot-th": {"dependencies":[],"location":{"type":"core"},"name":"ghc-boot-th","version":"8.6.5"}, - "ghc-lib": {"dependencies":["alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-lib-parser","ghc-prim","happy","hpc","pretty","process","time","transformers","unix"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-188559a1c65f9a4c19ac8e983ed79cd6.tar.gz"},"name":"ghc-lib","pinned":{"sha256":"5d73af2df22e55711500402d8d209ae9b5bf486120442cd2dceed6ba92e98756","strip-prefix":"ghc-lib-8.8.1.20201109"},"version":"8.8.1.20201109"}, - "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-188559a1c65f9a4c19ac8e983ed79cd6.tar.gz"},"name":"ghc-lib-parser","pinned":{"sha256":"4fd0a4d6d818b0e170d75061005fd0d4988288b3b26a3f07983f9971ee48a980","strip-prefix":"ghc-lib-parser-8.8.1.20201109"},"version":"8.8.1.20201109"}, + "ghc-lib": {"dependencies":["alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-lib-parser","ghc-prim","happy","hpc","pretty","process","time","transformers","unix"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-086a06e8f84b5227e5f63b1dc01b768a.tar.gz"},"name":"ghc-lib","pinned":{"sha256":"9b7977a09120100b9be5aee0319b88a0cd232a60271b36efaa0a2f5ea7544621","strip-prefix":"ghc-lib-8.8.1.20201203"},"version":"8.8.1.20201203"}, + "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-086a06e8f84b5227e5f63b1dc01b768a.tar.gz"},"name":"ghc-lib-parser","pinned":{"sha256":"714ddb325da3320ed7012cec7005f4f47a54cb9e6e4bed6817869c0eaf0306b2","strip-prefix":"ghc-lib-parser-8.8.1.20201203"},"version":"8.8.1.20201203"}, "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-paths": {"dependencies":["Cabal","base","directory"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ghc-paths-0.1.0.9/ghc-paths-0.1.0.9.tar.gz"},"name":"ghc-paths","pinned":{"url":["https://hackage.haskell.org/package/ghc-paths-0.1.0.9/ghc-paths-0.1.0.9.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-paths-0.1.0.9.tar.gz"],"sha256":"afa68fb86123004c37c1dc354286af2d87a9dcfb12ddcb80e8bd0cd55bc87945","cabal-sha256":"ed18df7b53699446dabd66f6e019e5b156820f0301d8dec0d6385f13b797e0ba"},"version":"0.1.0.9"}, "ghc-prim": {"dependencies":[],"location":{"type":"core"},"name":"ghc-prim","version":"0.5.3"}, diff --git a/stackage_snapshot_windows.json b/stackage_snapshot_windows.json index 2a4bc68cd8..ee7d9b2f4d 100644 --- a/stackage_snapshot_windows.json +++ b/stackage_snapshot_windows.json @@ -1,6 +1,6 @@ { - "__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": 1016593406, - "all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/23119b649cdeeb0d2c4691a80fd99e0648598bb0", + "__GENERATED_FILE_DO_NOT_MODIFY_MANUALLY": -714985599, + "all-cabal-hashes": "https://raw.githubusercontent.com/commercialhaskell/all-cabal-hashes/ddcf59b7f97123f20d0038f36e83a3c32ff204a5", "resolved": { "Cabal": {"dependencies":["Win32","array","base","binary","bytestring","containers","deepseq","directory","filepath","mtl","parsec","pretty","process","text","time","transformers"],"location":{"type":"core"},"name":"Cabal","version":"2.4.1.0"}, "Decimal": {"dependencies":["base","deepseq"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/Decimal-0.5.1/Decimal-0.5.1.tar.gz"},"name":"Decimal","pinned":{"url":["https://hackage.haskell.org/package/Decimal-0.5.1/Decimal-0.5.1.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/Decimal-0.5.1.tar.gz"],"sha256":"575ca5c65a8ea5a5bf2cd7b794a0d16622082cb501bf4b0327c5895c0b80f34c","cabal-sha256":"06bdd0f8badfb2104fd052f64888c283792a08f9a0d3661339e133e073080299"},"version":"0.5.1"}, @@ -95,8 +95,8 @@ "ghc": {"dependencies":[],"location":{"type":"core"},"name":"ghc","version":"8.6.5"}, "ghc-boot": {"dependencies":[],"location":{"type":"core"},"name":"ghc-boot","version":"8.6.5"}, "ghc-boot-th": {"dependencies":[],"location":{"type":"core"},"name":"ghc-boot-th","version":"8.6.5"}, - "ghc-lib": {"dependencies":["Win32","alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-lib-parser","ghc-prim","happy","hpc","pretty","process","time","transformers"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-188559a1c65f9a4c19ac8e983ed79cd6.tar.gz"},"name":"ghc-lib","pinned":{"sha256":"5d73af2df22e55711500402d8d209ae9b5bf486120442cd2dceed6ba92e98756","strip-prefix":"ghc-lib-8.8.1.20201109"},"version":"8.8.1.20201109"}, - "ghc-lib-parser": {"dependencies":["Win32","alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-prim","happy","hpc","pretty","process","time","transformers"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-188559a1c65f9a4c19ac8e983ed79cd6.tar.gz"},"name":"ghc-lib-parser","pinned":{"sha256":"4fd0a4d6d818b0e170d75061005fd0d4988288b3b26a3f07983f9971ee48a980","strip-prefix":"ghc-lib-parser-8.8.1.20201109"},"version":"8.8.1.20201109"}, + "ghc-lib": {"dependencies":["Win32","alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-lib-parser","ghc-prim","happy","hpc","pretty","process","time","transformers"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-086a06e8f84b5227e5f63b1dc01b768a.tar.gz"},"name":"ghc-lib","pinned":{"sha256":"9b7977a09120100b9be5aee0319b88a0cd232a60271b36efaa0a2f5ea7544621","strip-prefix":"ghc-lib-8.8.1.20201203"},"version":"8.8.1.20201203"}, + "ghc-lib-parser": {"dependencies":["Win32","alex","array","base","binary","bytestring","containers","deepseq","directory","filepath","ghc-prim","happy","hpc","pretty","process","time","transformers"],"location":{"type":"archive","url":"https://daml-binaries.da-ext.net/da-ghc-lib/ghc-lib-parser-086a06e8f84b5227e5f63b1dc01b768a.tar.gz"},"name":"ghc-lib-parser","pinned":{"sha256":"714ddb325da3320ed7012cec7005f4f47a54cb9e6e4bed6817869c0eaf0306b2","strip-prefix":"ghc-lib-parser-8.8.1.20201203"},"version":"8.8.1.20201203"}, "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-paths": {"dependencies":["Cabal","base","directory"],"location":{"type":"hackage","url":"https://hackage.haskell.org/package/ghc-paths-0.1.0.9/ghc-paths-0.1.0.9.tar.gz"},"name":"ghc-paths","pinned":{"url":["https://hackage.haskell.org/package/ghc-paths-0.1.0.9/ghc-paths-0.1.0.9.tar.gz","https://s3.amazonaws.com/hackage.fpcomplete.com/package/ghc-paths-0.1.0.9.tar.gz"],"sha256":"afa68fb86123004c37c1dc354286af2d87a9dcfb12ddcb80e8bd0cd55bc87945","cabal-sha256":"ed18df7b53699446dabd66f6e019e5b156820f0301d8dec0d6385f13b797e0ba"},"version":"0.1.0.9"}, "ghc-prim": {"dependencies":[],"location":{"type":"core"},"name":"ghc-prim","version":"0.5.3"},