Closure env is unit if no extra variable captured

This commit is contained in:
Denis Merigoux 2023-06-18 15:49:02 +02:00
parent 6962761774
commit 9cf55b0edd
2 changed files with 8 additions and 7 deletions

View File

@ -204,12 +204,14 @@ let rec transform_closures_expr :
[TAny, Expr.pos e] [TAny, Expr.pos e]
(Mark.get e)) (Mark.get e))
[ [
(if extra_vars_list = [] then Expr.elit LUnit binder_mark
else
Expr.etuple Expr.etuple
(List.map (List.map
(fun extra_var -> (fun extra_var ->
Bindlib.box_var extra_var, binder_mark) Bindlib.box_var extra_var, binder_mark)
extra_vars_list) extra_vars_list)
m; m);
] ]
(Mark.get e); (Mark.get e);
]) ])

View File

@ -39,7 +39,6 @@ scope Foo:
This test case is tricky because it creates a situation where the type of the This test case is tricky because it creates a situation where the type of the
two closures in Foo.r are different even with optimizations enabled. two closures in Foo.r are different even with optimizations enabled.
TODO fix this.
```catala-test-inline ```catala-test-inline
$ catala Lcalc --avoid_exceptions -O --closure_conversion -s Foo $ catala Lcalc --avoid_exceptions -O --closure_conversion -s Foo