Skip to content

Fix property test failures related to showConstructor #2394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions dhall/src/Dhall/Normalize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,11 @@ normalizeWithM ctx e0 = loop (Syntax.denote e0)
return $ case x' of
Field (Union ktsY) (Syntax.fieldSelectionLabel -> kY) ->
case Dhall.Map.lookup kY ktsY of
Just _ -> TextLit (Chunks [] kY)
Just Nothing -> TextLit (Chunks [] kY)
_ -> ShowConstructor x'
App (Field (Union ktsY) (Syntax.fieldSelectionLabel -> kY)) _ ->
case Dhall.Map.lookup kY ktsY of
Just (Just _) -> TextLit (Chunks [] kY)
_ -> ShowConstructor x'
Some _ ->
TextLit (Chunks [] "Some")
Expand Down Expand Up @@ -940,7 +944,14 @@ isNormalized e0 = loop (Syntax.denote e0)
RecordLit _ -> False
_ -> loop x && all loop t
ShowConstructor x -> loop x && case x of
Field (Union _) _ -> False
Field (Union kts) (Syntax.fieldSelectionLabel -> k) ->
case Dhall.Map.lookup k kts of
Just Nothing -> False
_ -> True
App (Field (Union kts) (Syntax.fieldSelectionLabel -> k)) _ ->
case Dhall.Map.lookup k kts of
Just (Just _) -> False
_ -> True
Some _ -> False
App None _ -> False
_ -> True
Expand Down