diff --git a/src/Nix/Eval.hs b/src/Nix/Eval.hs index 9b28103..526e7da 100644 --- a/src/Nix/Eval.hs +++ b/src/Nix/Eval.hs @@ -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] diff --git a/tests/EvalTests.hs b/tests/EvalTests.hs index ac2d7c8..0a6e992 100644 --- a/tests/EvalTests.hs +++ b/tests/EvalTests.hs @@ -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"