Skip to content

Commit 517ad02

Browse files
authored
Fix property test failures related to showConstructor (#2394)
1 parent 71a8374 commit 517ad02

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

dhall/src/Dhall/Normalize.hs

+13-2
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,11 @@ normalizeWithM ctx e0 = loop (Syntax.denote e0)
629629
return $ case x' of
630630
Field (Union ktsY) (Syntax.fieldSelectionLabel -> kY) ->
631631
case Dhall.Map.lookup kY ktsY of
632-
Just _ -> TextLit (Chunks [] kY)
632+
Just Nothing -> TextLit (Chunks [] kY)
633+
_ -> ShowConstructor x'
634+
App (Field (Union ktsY) (Syntax.fieldSelectionLabel -> kY)) _ ->
635+
case Dhall.Map.lookup kY ktsY of
636+
Just (Just _) -> TextLit (Chunks [] kY)
633637
_ -> ShowConstructor x'
634638
Some _ ->
635639
TextLit (Chunks [] "Some")
@@ -940,7 +944,14 @@ isNormalized e0 = loop (Syntax.denote e0)
940944
RecordLit _ -> False
941945
_ -> loop x && all loop t
942946
ShowConstructor x -> loop x && case x of
943-
Field (Union _) _ -> False
947+
Field (Union kts) (Syntax.fieldSelectionLabel -> k) ->
948+
case Dhall.Map.lookup k kts of
949+
Just Nothing -> False
950+
_ -> True
951+
App (Field (Union kts) (Syntax.fieldSelectionLabel -> k)) _ ->
952+
case Dhall.Map.lookup k kts of
953+
Just (Just _) -> False
954+
_ -> True
944955
Some _ -> False
945956
App None _ -> False
946957
_ -> True

0 commit comments

Comments
 (0)