Fix compound attributes in let bindings

Fix an issue where compound attributes would discard previous bindings
in a let statement.

`let a=1; b.b=2; c=3; in a` would fail, where
`let a=1; b.b=2; c=3; in c` would work as expected.
This commit is contained in:
Guillaume Maudoux 2019-11-24 02:35:52 +01:00 committed by John Wiegley
parent 8ce466ee80
commit 21c3c9c938
2 changed files with 8 additions and 2 deletions

View File

@ -207,8 +207,8 @@ attrSetAlter (k : ks) pos m p val = case M.lookup k m of
( M.insert
k
(toValue @(AttrSet v, AttrSet SourcePos) =<< (, mempty) <$> sequence st')
st
, M.insert k pos sp
m
, M.insert k pos p
)
desugarBinds :: forall r . ([Binding r] -> r) -> [Binding r] -> [Binding r]

View File

@ -139,6 +139,12 @@ case_find_file_failure_invalid_arg_no_path =
case_infinite_recursion =
assertNixEvalThrows "let foo = a: bar a; bar = a: foo a; in foo 3"
case_nested_let =
constantEqualText "3" "let a = 3; x.x = 2; in a"
case_nested_nested_let =
constantEqualText "3" "let a = 3; x.x = let b = a; in b; c = x.x; in c"
case_inherit_in_rec_set =
constantEqualText "1" "let x = 1; in (rec { inherit x; }).x"