From 4419abf57d76d99cfd2019c410806413104002e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Mon, 29 Jan 2018 15:46:34 +0100 Subject: [PATCH] Fix free vars of a lambda in Defun --- src/Defun.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Defun.ml b/src/Defun.ml index d464136..e92b7e3 100644 --- a/src/Defun.ml +++ b/src/Defun.ml @@ -77,7 +77,11 @@ let rec walk_term fs t = vars (S.vvars (List.tl args)) in let thisTag = freshTag () in - let freeVars = Atom.Set.elements @@ S.fv_term body in + let freeVars = Atom.Set.elements @@ + Atom.Set.diff + (S.fv_term body) + (Atom.Set.of_list vars) + in let thisFunc = T.Branch(thisTag, freeVars, nBody) in let fs = add_func fs arity thisFunc in