Skip to content

Commit 4559a27

Browse files
authored
Fix isNormalized for field selections (#1210)
In expressions like ({ x : Optional/fold } // {=}).x isNormalized didn't check if the expression being selected from was normalized. Fixes #1209.
1 parent 1d58840 commit 4559a27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dhall/src/Dhall/Core.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2013,9 +2013,9 @@ isNormalized e0 = loop (denote e0)
20132013
Field r k -> case r of
20142014
RecordLit _ -> False
20152015
Project _ _ -> False
2016-
Combine x@(RecordLit m) y -> loop x && loop y && Dhall.Map.member k m
2017-
Combine x (RecordLit m) -> loop x && Dhall.Map.toList (fmap loop m) == [(k, True)]
2018-
Prefer x@(RecordLit m) y -> loop x && loop y && Dhall.Map.member k m
2016+
Combine (RecordLit m) _ -> Dhall.Map.member k m && loop r
2017+
Combine _ (RecordLit m) -> Dhall.Map.keys m == [k] && loop r
2018+
Prefer (RecordLit m) _ -> Dhall.Map.member k m && loop r
20192019
Prefer _ (RecordLit _) -> False
20202020
_ -> loop r
20212021
Project r p -> loop r &&

0 commit comments

Comments
 (0)