diff --git a/compiler/lcalc/closure_conversion.ml b/compiler/lcalc/closure_conversion.ml index 1eac038a..11622362 100644 --- a/compiler/lcalc/closure_conversion.ml +++ b/compiler/lcalc/closure_conversion.ml @@ -204,12 +204,14 @@ let rec transform_closures_expr : [TAny, Expr.pos e] (Mark.get e)) [ - Expr.etuple - (List.map - (fun extra_var -> - Bindlib.box_var extra_var, binder_mark) - extra_vars_list) - m; + (if extra_vars_list = [] then Expr.elit LUnit binder_mark + else + Expr.etuple + (List.map + (fun extra_var -> + Bindlib.box_var extra_var, binder_mark) + extra_vars_list) + m); ] (Mark.get e); ]) diff --git a/tests/test_func/good/scope_call_func_struct_closure.catala_en b/tests/test_func/good/scope_call_func_struct_closure.catala_en index 14d5c543..06c3aba1 100644 --- a/tests/test_func/good/scope_call_func_struct_closure.catala_en +++ b/tests/test_func/good/scope_call_func_struct_closure.catala_en @@ -39,7 +39,6 @@ scope Foo: 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. -TODO fix this. ```catala-test-inline $ catala Lcalc --avoid_exceptions -O --closure_conversion -s Foo