about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r--src/libexpr/nixexpr.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 7739e99a96be..8fe5d379af71 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -205,8 +205,11 @@ Expr substitute(const ATermMap & subs, Expr e)
         for (ATermIterator i(rbnds); i; ++i)
             if (atMatch(m, *i) >> "Bind" >> name)
                 subs2.remove(name);
-            else
-                abort(); /* can't happen */
+            else abort(); /* can't happen */
+        for (ATermIterator i(nrbnds); i; ++i)
+            if (atMatch(m, *i) >> "Bind" >> name)
+                subs2.remove(name);
+            else abort(); /* can't happen */
         return ATmake("Rec(<term>, <term>)",
             substitute(subs2, (ATerm) rbnds),
             substitute(subs, (ATerm) nrbnds));
@@ -264,14 +267,18 @@ void checkVarDefs(const ATermMap & defs, Expr e)
     }
         
     else if (atMatch(m, e) >> "Rec" >> rbnds >> nrbnds) {
-        checkVarDefs(defs
-            , (ATerm) nrbnds);
+        checkVarDefs(defs, (ATerm) nrbnds);
         ATermMap defs2(defs);
         for (ATermIterator i(rbnds); i; ++i) {
             if (!(atMatch(m, *i) >> "Bind" >> name))
                 abort(); /* can't happen */
             defs2.set(name, (ATerm) ATempty);
         }
+        for (ATermIterator i(nrbnds); i; ++i) {
+            if (!(atMatch(m, *i) >> "Bind" >> name))
+                abort(); /* can't happen */
+            defs2.set(name, (ATerm) ATempty);
+        }
         checkVarDefs(defs2, (ATerm) rbnds);
     }