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.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index dec734e46647..78f89db5e5d3 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -296,7 +296,7 @@ void checkVarDefs(const ATermMap & defs, Expr e)
     ATMatcher m;
     ATerm name;
     ATermList formals;
-    ATerm body;
+    ATerm with, body;
     ATermList rbnds, nrbnds;
 
     if (atMatch(m, e) >> "Var" >> name) {
@@ -340,6 +340,13 @@ void checkVarDefs(const ATermMap & defs, Expr e)
         }
         checkVarDefs(defs2, (ATerm) rbnds);
     }
+
+    else if (atMatch(m, e) >> "With" >> with >> body) {
+        /* We can't check the body without evaluating the definitions
+           (which is an arbitrary expression), so we don't do that
+           here but only when actually evaluating the `with'. */
+        checkVarDefs(defs, with);
+    }
     
     else if (ATgetType(e) == AT_APPL) {
         int arity = ATgetArity(ATgetAFun(e));