about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/nixexpr.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 123513594512..1eeec2cf19f7 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -215,7 +215,11 @@ static void checkVarDefs2(set<Expr> & done, const ATermMap & defs, Expr e)
     ATerm with, body;
     ATermList rbnds, nrbnds;
 
-    if (matchVar(e, name)) {
+    /* Closed terms don't have free variables, so we don't have to
+       check by definition. */
+    if (matchClosed(e, value)) return;
+    
+    else if (matchVar(e, name)) {
         if (!defs.get(name))
             throw EvalError(format("undefined variable `%1%'")
                 % aterm2String(name));