Skip to content

Commit 40767ac

Browse files
authored
Allow whitespace after record pun entry (#1733)
Fixes #1732.
1 parent 7fcd18d commit 40767ac

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

dhall/src/Dhall/Parser/Expression.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,6 @@ parsers embedded = Parsers {..}
772772

773773
value <- expression
774774

775-
whitespace
776-
777775
let cons key (key', values) =
778776
(key, RecordLit [ (key', values) ])
779777

@@ -786,7 +784,7 @@ parsers embedded = Parsers {..}
786784
x :| [] -> return (x, Var (V x 0))
787785
_ -> empty
788786

789-
normalRecordEntry <|> punnedEntry
787+
(normalRecordEntry <|> punnedEntry) <* whitespace
790788

791789
let nonEmptyRecordLiteral = do
792790
as <- Text.Megaparsec.sepBy1 keysValue (_comma *> whitespace)

dhall/tests/Dhall/Test/Regression.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ tests =
4444
, issue1341
4545
, issue1584
4646
, issue1646
47+
, issue1732
4748
, parsing0
4849
, typeChecking0
4950
, typeChecking1
@@ -196,6 +197,13 @@ issue1646 = Test.Tasty.HUnit.testCase "Issue #1646" (do
196197
_ <- Util.code "./tests/regression/issue1646.dhall"
197198
return () )
198199

200+
issue1732 :: TestTree
201+
issue1732 = Test.Tasty.HUnit.testCase "Issue #1732" (do
202+
-- This test ensures that the parser allows whitespace after a record pun
203+
-- entry
204+
_ <- Util.code "./tests/regression/issue1732.dhall"
205+
return () )
206+
199207
parsing0 :: TestTree
200208
parsing0 = Test.Tasty.HUnit.testCase "Parsing regression #0" (do
201209
-- Verify that parsing should not fail
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
let x = 0 in { x , a = 0 }

0 commit comments

Comments
 (0)