From 324ca740536e034d5f9856e2c824c8f8d04cff06 Mon Sep 17 00:00:00 2001 From: adelaett <90894311+adelaett@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:08:58 +0100 Subject: [PATCH] typed defaults: fixed interpreter value initialization in lcalc mode when having the avoid_exceptions flag enabled. --- compiler/shared_ast/interpreter.ml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/shared_ast/interpreter.ml b/compiler/shared_ast/interpreter.ml index 123084ff..855c6693 100644 --- a/compiler/shared_ast/interpreter.ml +++ b/compiler/shared_ast/interpreter.ml @@ -838,17 +838,20 @@ let interpret_program_lcalc p s : (Uid.MarkedString.info * ('a, 'm) gexpr) list StructField.Map.map (fun ty -> match Mark.remove ty with - | TOption _ -> - (Expr.einj ~e:(Expr.elit LUnit mark_e) ~cons:Expr.none_constr - ~name:Expr.option_enum mark_e - : (_, _) boxed_gexpr) + | TArrow (ty_in, (TOption _, _)) -> + Expr.make_abs + (Array.of_list @@ List.map (fun _ -> Var.make "_") ty_in) + (Expr.einj ~e:(Expr.elit LUnit mark_e) ~cons:Expr.none_constr + ~name:Expr.option_enum mark_e + : (_, _) boxed_gexpr) + ty_in (Expr.mark_pos mark_e) | _ -> Message.raise_spanned_error (Mark.get ty) "This scope needs input arguments to be executed. But the Catala \ built-in interpreter does not have a way to retrieve input \ values from the command line, so it cannot execute this scope. \ Please create another scope that provides the input arguments \ - to this one and execute it instead. ") + to this one and execute it instead.") taus in let to_interpret =