Skip to content

Commit 46a8f56

Browse files
Always parenthesize custom headers (#2280)
Fixes #2273 This avoids ambiguous parses for expressions like: ```dhall https://example.com using ./headers.dhall sha256:… ``` … where the integrity check could be modifying either the original import or the custom headers. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 3aed93f commit 46a8f56

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

dhall/src/Dhall/Syntax.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ instance Pretty URL where
10281028
<> foldMap prettyHeaders headers
10291029
where
10301030
prettyHeaders h =
1031-
" using " <> Pretty.unAnnotate (prettyImportExpression h)
1031+
" using (" <> Pretty.unAnnotate (Pretty.pretty h) <> ")"
10321032

10331033
File {..} = path
10341034

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- https://github.com/dhall-lang/dhall-haskell/issues/2273
2+
let MyPackage =
3+
https://server.test/package.dhall using (./headers.dhall)
4+
sha256:03a6e298ff140d430cea8b387fad886ce9f5bee24622c7d1102115cc08ed9cf8
5+
6+
in MyPackage
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- https://github.com/dhall-lang/dhall-haskell/issues/2273
2+
let MyPackage =
3+
https://server.test/package.dhall using (./headers.dhall)
4+
sha256:03a6e298ff140d430cea8b387fad886ce9f5bee24622c7d1102115cc08ed9cf8
5+
6+
in MyPackage

0 commit comments

Comments
 (0)