Forward types in the Expr.make_* constructors

Also add some safeguards against bad propagation of types (e.g. checking the
arrow type of functions upon application); partly disabled at the moment since
they don't pass yet but that'll be further work.
This commit is contained in:
Louis Gesbert 2022-09-12 17:03:44 +02:00
parent 0ddff5a50b
commit d93b699a4c
17 changed files with 9870 additions and 9058 deletions

View File

@ -288,7 +288,7 @@ let rec rule_tree_to_expr
in
Expr.make_abs
[| Var.Map.find new_param ctx.var_mapping |]
default [typ] emark
default [typ] def_pos
else default
| _ -> (* should not happen *) assert false

View File

@ -74,12 +74,12 @@ let make_matchopt_with_abs_arms arg e_none e_some =
[match arg with | None () -> e_none | Some v -> e_some]. It binds v to
e_some, permitting it to be used inside the expression. There is no
requirements on the form of both e_some and e_none. *)
let make_matchopt m v tau arg e_none e_some =
let make_matchopt pos v tau arg e_none e_some =
let x = Var.make "_" in
make_matchopt_with_abs_arms arg
(Expr.make_abs [| x |] e_none [TLit TUnit, Expr.mark_pos m] m)
(Expr.make_abs [| v |] e_some [tau] m)
(Expr.make_abs [| x |] e_none [TLit TUnit, pos] pos)
(Expr.make_abs [| v |] e_some [tau] pos)
let handle_default = Var.make "handle_default"
let handle_default_opt = Var.make "handle_default_opt"

View File

@ -43,7 +43,7 @@ val make_matchopt_with_abs_arms :
'm expr Bindlib.box
val make_matchopt :
'm mark ->
Utils.Pos.t ->
'm expr Var.t ->
typ ->
'm expr Bindlib.box ->

View File

@ -162,7 +162,7 @@ let closure_conversion_expr (type m) (ctx : m ctx) (e : m expr) :
(Array.concat [Array.make 1 inner_c_var; vars])
new_closure_body
((TAny, binder_pos) :: typs)
(Marked.get_mark e)
(Expr.pos e)
in
( Expr.make_let_in code_var
(TAny, Expr.pos e)

View File

@ -23,10 +23,11 @@ type 'm ctx = ('m D.expr, 'm A.expr Var.t) Var.Map.t
(** This environment contains a mapping between the variables in Dcalc and their
correspondance in Lcalc. *)
let thunk_expr (e : 'm A.expr Bindlib.box) (mark : 'm mark) :
'm A.expr Bindlib.box =
let thunk_expr (type m) (e : m A.expr Bindlib.box) : m A.expr Bindlib.box =
let dummy_var = Var.make "_" in
Expr.make_abs [| dummy_var |] e [TAny, Expr.mark_pos mark] mark
let pos = Expr.pos (Bindlib.unbox e) in
let arg_t = Marked.mark pos (TLit TUnit) in
Expr.make_abs [| dummy_var |] e [arg_t] pos
let rec translate_default
(ctx : 'm ctx)
@ -35,19 +36,17 @@ let rec translate_default
(cons : 'm D.expr)
(mark_default : 'm mark) : 'm A.expr Bindlib.box =
let exceptions =
List.map
(fun except -> thunk_expr (translate_expr ctx except) mark_default)
exceptions
List.map (fun except -> thunk_expr (translate_expr ctx except)) exceptions
in
let exceptions =
Expr.make_app
(Expr.make_var (Var.translate A.handle_default, mark_default))
[
Expr.earray exceptions mark_default;
thunk_expr (translate_expr ctx just) mark_default;
thunk_expr (translate_expr ctx cons) mark_default;
thunk_expr (translate_expr ctx just);
thunk_expr (translate_expr ctx cons);
]
mark_default
(Expr.mark_pos mark_default)
in
exceptions

View File

@ -158,7 +158,8 @@ let disjoint_union_maps (pos : Pos.t) (cs : ('e, 'a) Var.Map.t list) :
hoists, has the non-empty value in e_v. *)
let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
'm A.expr Bindlib.box * 'm hoists =
let pos = Marked.get_mark e in
let mark = Marked.get_mark e in
let pos = Expr.mark_pos mark in
match Marked.unmark e with
(* empty-producing/using terms. We hoist those. (D.EVar in some cases,
EApp(D.EVar _, [ELit LUnit]), EDefault _, ELit LEmptyDefault) I'm unsure
@ -172,23 +173,23 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
let v' = Var.make (Bindlib.name_of v) in
(* Cli.debug_print @@ Format.asprintf "Found an unpure variable %a,
created a variable %a to replace it" Print.var v Print.var v'; *)
Expr.make_var (v', pos), Var.Map.singleton v' e
Expr.make_var (v', mark), Var.Map.singleton v' e
else (find ~info:"should never happen" v ctx).naked_expr, Var.Map.empty
| EApp ((EVar v, p), [(ELit LUnit, _)]) ->
if not (find ~info:"search for a variable" v ctx).is_pure then
let v' = Var.make (Bindlib.name_of v) in
(* Cli.debug_print @@ Format.asprintf "Found an unpure variable %a,
created a variable %a to replace it" Print.var v Print.var v'; *)
Expr.make_var (v', pos), Var.Map.singleton v' (EVar v, p)
Expr.make_var (v', mark), Var.Map.singleton v' (EVar v, p)
else
Errors.raise_spanned_error (Expr.pos e)
"Internal error: an pure variable was found in an unpure environment."
| EDefault (_exceptions, _just, _cons) ->
let v' = Var.make "default_term" in
Expr.make_var (v', pos), Var.Map.singleton v' e
Expr.make_var (v', mark), Var.Map.singleton v' e
| ELit LEmptyError ->
let v' = Var.make "empty_litteral" in
Expr.make_var (v', pos), Var.Map.singleton v' e
Expr.make_var (v', mark), Var.Map.singleton v' e
(* This one is a very special case. It transform an unpure expression
environement to a pure expression. *)
| ErrorOnEmpty arg ->
@ -197,25 +198,25 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
let x = Var.make "non_empty_argument" in
let arg' = translate_expr ctx arg in
let rty = Expr.maybe_ty mark in
( A.make_matchopt_with_abs_arms arg'
(Expr.make_abs [| silent_var |]
(Bindlib.box (ERaise NoValueProvided, pos))
[TAny, Expr.pos e]
pos)
(Expr.make_abs [| x |] (Expr.make_var (x, pos)) [TAny, Expr.pos e] pos),
(Bindlib.box (ERaise NoValueProvided, Expr.with_ty mark rty))
[rty] pos)
(Expr.make_abs [| x |] (Expr.make_var (x, mark)) [rty] pos),
Var.Map.empty )
(* pure terms *)
| ELit
((LBool _ | LInt _ | LRat _ | LMoney _ | LUnit | LDate _ | LDuration _) as
l) ->
Expr.elit l pos, Var.Map.empty
Expr.elit l mark, Var.Map.empty
| EIfThenElse (e1, e2, e3) ->
let e1', h1 = translate_and_hoist ctx e1 in
let e2', h2 = translate_and_hoist ctx e2 in
let e3', h3 = translate_and_hoist ctx e3 in
let e' = Expr.eifthenelse e1' e2' e3' pos in
let e' = Expr.eifthenelse e1' e2' e3' mark in
(*(* equivalent code : *) let e' = let+ e1' = e1' and+ e2' = e2' and+ e3' =
e3' in (A.EIfThenElse (e1', e2', e3'), pos) in *)
@ -224,7 +225,7 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
(* same behavior as in the ICFP paper: if e1 is empty, then no error is
raised. *)
let e1', h1 = translate_and_hoist ctx e1 in
Expr.eassert e1' pos, h1
Expr.eassert e1' mark, h1
| EAbs (binder, ts) ->
let vars, body = Bindlib.unmbind binder in
let ctx, lc_vars =
@ -235,7 +236,7 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
The code should behave correctly in the without this assumption if
we put here an is_pure=false, but the types are more compilcated.
(unimplemented for now) *)
let ctx = add_var pos var true ctx in
let ctx = add_var mark var true ctx in
let lc_var = (find var ctx).var in
ctx, lc_var :: lc_vars)
in
@ -247,7 +248,7 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
let new_binder = Bindlib.bind_mvar lc_vars new_body in
( Bindlib.box_apply
(fun new_binder -> EAbs (new_binder, List.map translate_typ ts), pos)
(fun new_binder -> EAbs (new_binder, List.map translate_typ ts), mark)
new_binder,
hoists )
| EApp (e1, args) ->
@ -257,7 +258,7 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
in
let hoists = disjoint_union_maps (Expr.pos e) (h1 :: h_args) in
let e' = Expr.eapp e1' args' pos in
let e' = Expr.eapp e1' args' mark in
e', hoists
| ETuple (args, s) ->
let args', h_args =
@ -265,14 +266,14 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
in
let hoists = disjoint_union_maps (Expr.pos e) h_args in
Expr.etuple args' s pos, hoists
Expr.etuple args' s mark, hoists
| ETupleAccess (e1, i, s, ts) ->
let e1', hoists = translate_and_hoist ctx e1 in
let e1' = Expr.etupleaccess e1' i s ts pos in
let e1' = Expr.etupleaccess e1' i s ts mark in
e1', hoists
| EInj (e1, i, en, ts) ->
let e1', hoists = translate_and_hoist ctx e1 in
let e1' = Expr.einj e1' i en ts pos in
let e1' = Expr.einj e1' i en ts mark in
e1', hoists
| EMatch (e1, cases, en) ->
let e1', h1 = translate_and_hoist ctx e1 in
@ -281,13 +282,13 @@ let rec translate_and_hoist (ctx : 'm ctx) (e : 'm D.expr) :
in
let hoists = disjoint_union_maps (Expr.pos e) (h1 :: h_cases) in
let e' = Expr.ematch e1' cases' en pos in
let e' = Expr.ematch e1' cases' en mark in
e', hoists
| EArray es ->
let es', hoists = es |> List.map (translate_and_hoist ctx) |> List.split in
Expr.earray es' pos, disjoint_union_maps (Expr.pos e) hoists
| EOp op -> Bindlib.box (EOp op, pos), Var.Map.empty
Expr.earray es' mark, disjoint_union_maps (Expr.pos e) hoists
| EOp op -> Bindlib.box (EOp op, mark), Var.Map.empty
and translate_expr ?(append_esome = true) (ctx : 'm ctx) (e : 'm D.expr) :
'm A.expr Bindlib.box =
@ -303,6 +304,7 @@ and translate_expr ?(append_esome = true) (ctx : 'm ctx) (e : 'm D.expr) :
~init:(if append_esome then A.make_some e' else e')
~f:(fun acc (v, (hoist, mark_hoist)) ->
(* Cli.debug_print @@ Format.asprintf "hoist using A.%a" Print.var v; *)
let pos = Expr.mark_pos mark_hoist in
let c' : 'm A.expr Bindlib.box =
match hoist with
(* Here we have to handle only the cases appearing in hoists, as defined
@ -322,7 +324,7 @@ and translate_expr ?(append_esome = true) (ctx : 'm ctx) (e : 'm D.expr) :
just';
cons';
]
mark_hoist
pos
| ELit LEmptyError -> A.make_none mark_hoist
| EAssert arg ->
let arg' = translate_expr ctx arg in
@ -336,13 +338,13 @@ and translate_expr ?(append_esome = true) (ctx : 'm ctx) (e : 'm D.expr) :
(Expr.make_abs [| silent_var |]
(Bindlib.box (ERaise NoValueProvided, mark_hoist))
[TAny, Expr.mark_pos mark_hoist]
mark_hoist)
pos)
(Expr.make_abs [| x |]
(Bindlib.box_apply
(fun arg -> EAssert arg, mark_hoist)
(Expr.make_var (x, mark_hoist)))
[TAny, Expr.mark_pos mark_hoist]
mark_hoist)
pos)
| _ ->
Errors.raise_spanned_error (Expr.mark_pos mark_hoist)
"Internal Error: An term was found in a position where it should \
@ -353,7 +355,7 @@ and translate_expr ?(append_esome = true) (ctx : 'm ctx) (e : 'm D.expr) :
] *)
(* Cli.debug_print @@ Format.asprintf "build matchopt using %a" Print.var
v; *)
A.make_matchopt mark_hoist v
A.make_matchopt pos v
(TAny, Expr.mark_pos mark_hoist)
c' (A.make_none mark_hoist) acc)

View File

@ -67,12 +67,21 @@ let pos_mark (pos : Pos.t) : untyped mark = Untyped { pos }
let pos_mark_as e = pos_mark (Marked.get_mark e)
let merge_defaults
(caller : untyped Dcalc.Ast.expr Bindlib.box)
(callee : untyped Dcalc.Ast.expr Bindlib.box) :
untyped Dcalc.Ast.expr Bindlib.box =
(caller : 'a Dcalc.Ast.expr Bindlib.box)
(callee : 'a Dcalc.Ast.expr Bindlib.box) : 'a Dcalc.Ast.expr Bindlib.box =
let caller =
let m = Marked.get_mark (Bindlib.unbox caller) in
Expr.make_app caller [Bindlib.box (ELit LUnit, m)] m
let pos = Expr.mark_pos m in
Expr.make_app caller
[
Bindlib.box
( ELit LUnit,
Expr.map_mark
(fun _ -> pos)
(fun _ -> Marked.mark pos (TLit TUnit))
m );
]
pos
in
let body =
Bindlib.box_apply2
@ -429,7 +438,7 @@ let translate_rule
| Reentrant ->
Expr.make_abs [| silent_var |] new_e
[TLit TUnit, var_def_pos]
(pos_mark var_def_pos)
var_def_pos
in
( (fun next ->
Bindlib.box_apply2

View File

@ -98,7 +98,7 @@ let pos (type m) (x : ('a, m mark) Marked.t) : Pos.t =
let ty (_, m) : typ = match m with Typed { ty; _ } -> ty
let with_ty (type m) (ty : typ) (x : ('a, m mark) Marked.t) :
let set_ty (type m) (ty : typ) (x : ('a, m mark) Marked.t) :
('a, typed mark) Marked.t =
Marked.mark
(match Marked.get_mark x with
@ -138,6 +138,15 @@ let fold_marks
ty = ty_f (List.map (function Typed m -> m) ms);
}
let map_ty (type m) (ty_f : typ -> typ) (m : m mark) : m mark =
map_mark (fun pos -> pos) ty_f m
let with_ty (type m) (m : m mark) ?pos (ty : typ) : m mark =
map_mark (fun default -> Option.value pos ~default) (fun _ -> ty) m
let maybe_ty (type m) ?(typ = TAny) (m : m mark) : typ =
match m with Untyped { pos } -> Marked.mark pos typ | Typed { ty; _ } -> ty
(* - Traversal functions - *)
(* shallow map *)
@ -205,74 +214,6 @@ let box e =
let untype e = map_marks ~f:(fun m -> Untyped { pos = mark_pos m }) e
(* - Expression building helpers - *)
let make_var (x, mark) =
Bindlib.box_apply (fun x -> x, mark) (Bindlib.box_var x)
let make_abs xs e taus mark =
Bindlib.box_apply (fun b -> EAbs (b, taus), mark) (Bindlib.bind_mvar xs e)
let make_app e u mark =
Bindlib.box_apply2 (fun e u -> EApp (e, u), mark) e (Bindlib.box_list u)
let empty_thunked_term mark =
let silent = Var.make "_" in
let pos = mark_pos mark in
Bindlib.unbox
(make_abs [| silent |]
(Bindlib.box (ELit LEmptyError, mark))
[TLit TUnit, pos]
(map_mark
(fun pos -> pos)
(fun ty ->
Marked.mark pos (TArrow (Marked.mark pos (TLit TUnit), ty)))
mark))
let make_let_in x tau e1 e2 pos =
let m_e1 = Marked.get_mark (Bindlib.unbox e1) in
let m_e2 = Marked.get_mark (Bindlib.unbox e2) in
let m_abs =
map_mark2
(fun _ _ -> pos)
(fun m1 m2 -> Marked.mark pos (TArrow (m1.ty, m2.ty)))
m_e1 m_e2
in
make_app (make_abs [| x |] e2 [tau] m_abs) [e1] m_e2
let make_multiple_let_in xs taus e1s e2 pos =
(* let m_e1s = List.map (fun e -> Marked.get_mark (Bindlib.unbox e)) e1s in *)
let m_e1s =
fold_marks List.hd
(fun tys -> TTuple (List.map (fun t -> t.ty) tys), (List.hd tys).pos)
(List.map (fun e -> Marked.get_mark (Bindlib.unbox e)) e1s)
in
let m_e2 = Marked.get_mark (Bindlib.unbox e2) in
let m_abs =
map_mark2
(fun _ _ -> pos)
(fun m1 m2 -> Marked.mark pos (TArrow (m1.ty, m2.ty)))
m_e1s m_e2
in
make_app (make_abs xs e2 taus m_abs) e1s m_e2
let make_default exceptions just cons mark =
let rec bool_value = function
| ELit (LBool b), _ -> Some b
| EApp ((EOp (Unop (Log (l, _))), _), [e]), _
when l <> PosRecordIfTrueBool
(* we don't remove the log calls corresponding to source code
definitions !*) ->
bool_value e
| _ -> None
in
match exceptions, bool_value just, cons with
| [], Some true, cons -> cons
| exceptions, Some true, (EDefault ([], just, cons), mark) ->
EDefault (exceptions, just, cons), mark
| [except], Some false, _ -> except
| exceptions, _, cons -> EDefault (exceptions, just, cons), mark
(* Tests *)
let is_value (type a) (e : (a, _) gexpr) =
@ -756,3 +697,80 @@ let rec size : type a. (a, 't) gexpr -> int =
| EEnumInj (e1, _, _) -> 1 + size e1
| EMatchS (e1, _, cases) ->
EnumConstructorMap.fold (fun _ e acc -> acc + 1 + size e) cases (size e1)
(* - Expression building helpers - *)
let make_var (x, mark) =
Bindlib.box_apply (fun x -> x, mark) (Bindlib.box_var x)
let make_abs xs e taus pos =
let mark =
map_mark
(fun _ -> pos)
(fun ety ->
List.fold_right
(fun tx acc -> Marked.mark pos (TArrow (tx, acc)))
taus ety)
(Marked.get_mark (Bindlib.unbox e))
in
Bindlib.box_apply (fun b -> EAbs (b, taus), mark) (Bindlib.bind_mvar xs e)
let make_app e u pos =
Bindlib.box_apply2
(fun e u ->
let mark =
fold_marks
(fun _ -> pos)
(function
| [] -> assert false
| fty :: argtys ->
List.fold_left
(fun tf tx ->
match Marked.unmark tf with
| TArrow (tx', tr) ->
assert (Marked.unmark tx' = TAny || equal_typ tx.ty tx');
(* wrong arg type *)
tr
| TAny -> tf
| _ -> Marked.same_mark_as TAny tf
(* TODO: enable this assert and debug cases where we propagate wrong types!
* Format.kasprintf failwith "Attempt to construct application of 'function' of type %a"
* (fun ppf t -> Print.typ {ctx_enums = EnumMap.empty; ctx_structs = StructMap.empty} ppf t) tf
* (\* apply of non-arrow type *\) *))
fty.ty argtys)
(List.map Marked.get_mark (e :: u))
in
EApp (e, u), mark)
e (Bindlib.box_list u)
let empty_thunked_term mark =
let silent = Var.make "_" in
let pos = mark_pos mark in
Bindlib.unbox
(make_abs [| silent |]
(Bindlib.box (ELit LEmptyError, mark))
[TLit TUnit, pos]
pos)
let make_let_in x tau e1 e2 mpos =
make_app (make_abs [| x |] e2 [tau] mpos) [e1] (pos (Bindlib.unbox e2))
let make_multiple_let_in xs taus e1s e2 mpos =
make_app (make_abs xs e2 taus mpos) e1s (pos (Bindlib.unbox e2))
let make_default exceptions just cons mark =
let rec bool_value = function
| ELit (LBool b), _ -> Some b
| EApp ((EOp (Unop (Log (l, _))), _), [e]), _
when l <> PosRecordIfTrueBool
(* we don't remove the log calls corresponding to source code
definitions !*) ->
bool_value e
| _ -> None
in
match exceptions, bool_value just, cons with
| [], Some true, cons -> cons
| exceptions, Some true, (EDefault ([], just, cons), mark) ->
EDefault (exceptions, just, cons), mark
| [except], Some false, _ -> except
| exceptions, _, cons -> EDefault (exceptions, just, cons), mark

View File

@ -103,9 +103,13 @@ val eraise : except -> 't -> (lcalc, 't) gexpr box
val no_mark : 'm mark -> 'm mark
val mark_pos : 'm mark -> Pos.t
val pos : ('e, _ mark) gexpr -> Pos.t
val ty : (_, typed mark) Marked.t -> typ
val with_ty : typ -> ('a, _ mark) Marked.t -> ('a, typed mark) Marked.t
val with_ty : 'm mark -> ?pos:Pos.t -> typ -> 'm mark
(** Adds the given type information only on typed marks *)
val map_ty : (typ -> typ) -> 'm mark -> 'm mark
(** Identity on untyped marks*)
val map_mark : (Pos.t -> Pos.t) -> (typ -> typ) -> 'm mark -> 'm mark
val map_mark2 :
@ -118,6 +122,15 @@ val map_mark2 :
val fold_marks :
(Pos.t list -> Pos.t) -> (typed list -> typ) -> 'm mark list -> 'm mark
val maybe_ty : ?typ:naked_typ -> 'm mark -> typ
(** Returns the corresponding type on a typed expr, or [typ] (defaulting to
[TAny]) at the current position on an untyped one *)
(** Manipulation of marked expressions *)
val pos : ('e, 'm mark) gexpr -> Pos.t
val ty : ('e, typed mark) Marked.t -> typ
val set_ty : typ -> ('a, 'm mark) Marked.t -> ('a, typed mark) Marked.t
val untype : ('a, 'm mark) gexpr -> ('a, untyped mark) gexpr box
(** {2 Traversal functions} *)
@ -161,16 +174,16 @@ val map_marks : f:('t1 -> 't2) -> ('a, 't1) gexpr -> ('a, 't2) gexpr box
val make_var : ('a, 't) gexpr Var.t * 'b -> (('a, 't) naked_gexpr * 'b) box
val make_abs :
('a, 't) gexpr Var.vars ->
('a, 't) gexpr box ->
('a, 'm mark) gexpr Var.vars ->
('a, 'm mark) gexpr box ->
typ list ->
't ->
('a, 't) gexpr box
Pos.t ->
('a, 'm mark) gexpr box
val make_app :
('a any, 'm mark) gexpr box ->
('a, 'm mark) gexpr box list ->
'm mark ->
Pos.t ->
('a, 'm mark) gexpr box
val empty_thunked_term :
@ -181,7 +194,7 @@ val make_let_in :
typ ->
('a, 'm mark) gexpr box ->
('a, 'm mark) gexpr box ->
Utils.Pos.t ->
Pos.t ->
('a, 'm mark) gexpr box
val make_multiple_let_in :
@ -238,6 +251,7 @@ val compare : ('a, 't) gexpr -> ('a, 't) gexpr -> int
(** Standard comparison function, suitable for e.g. [Set.Make]. Ignores position
information *)
val equal_typ : typ -> typ -> bool
val compare_typ : typ -> typ -> int
val is_value : ('a any, 't) gexpr -> bool
val free_vars : ('a any, 't) gexpr -> ('a, 't) gexpr Var.Set.t

View File

@ -130,7 +130,7 @@ let to_expr (ctx : decl_ctx) (body : 'e scope_body) (mark_scope : 'm mark) :
let body_expr = unfold_body_expr ctx body_expr in
Expr.make_abs [| var |] body_expr
[TStruct body.scope_body_input_struct, Expr.mark_pos mark_scope]
mark_scope
(Expr.mark_pos mark_scope)
let format
?(debug : bool = false)

View File

@ -148,13 +148,13 @@ let rec translate_expr
Bindlib.unbox
(Expr.make_abs [| nop_var |]
(Bindlib.box (ELit (LBool false), emark))
[tau] emark)
[tau] pos)
else
let ctxt, binding_var =
Name_resolution.add_def_local_var ctxt (Marked.unmark binding)
in
let e2 = translate_expr scope inside_definition_of ctxt e2 in
Bindlib.unbox (Expr.make_abs [| binding_var |] e2 [tau] emark))
Bindlib.unbox (Expr.make_abs [| binding_var |] e2 [tau] pos))
(EnumMap.find enum_uid ctxt.enums)
in
Bindlib.box_apply
@ -344,7 +344,7 @@ let rec translate_expr
let fn =
Expr.make_abs [| v |]
(translate_expr scope inside_definition_of ctxt e2)
[tau] emark
[tau] pos
in
Bindlib.box_apply2
(fun fn arg -> EApp (fn, [arg]), emark)
@ -491,7 +491,7 @@ let rec translate_expr
(Bindlib.box
( ELit (LBool (EnumConstructor.compare c_uid c_uid' = 0)),
emark ))
[tau] emark))
[tau] pos))
(EnumMap.find enum_uid ctxt.enums)
in
Bindlib.box_apply
@ -514,7 +514,7 @@ let rec translate_expr
Expr.make_abs [| param |]
(translate_expr scope inside_definition_of ctxt predicate)
[TAny, pos]
emark
pos
in
Bindlib.box_apply2
(fun f_pred collection ->
@ -557,7 +557,7 @@ let rec translate_expr
Expr.make_abs [| param |]
(translate_expr scope inside_definition_of ctxt predicate)
[TAny, pos]
emark
pos
in
let f_pred_var = Var.make "predicate" in
let f_pred_var_e =
@ -586,9 +586,7 @@ let rec translate_expr
acc_var_e item_var_e f_pred_var_e
in
let fold_f =
Expr.make_abs [| acc_var; item_var |] fold_body
[TAny, pos; TAny, pos]
emark
Expr.make_abs [| acc_var; item_var |] fold_body [TAny, pos; TAny, pos] pos
in
let fold =
Bindlib.box_apply3
@ -680,7 +678,7 @@ let rec translate_expr
| Ast.Date -> KDate, (TLit TDate, pos)
| _ ->
Errors.raise_spanned_error pos
"ssible to compute the %s of two values of type %a"
"It is impossible to compute the %s of two values of type %a"
(if max_or_min then "max" else "min")
SurfacePrint.format_primitive_typ t
in

10406
french_law/js/french_law.js generated

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -545,11 +545,11 @@ def smic(smic_in:SmicIn):
date_courante = smic_in.date_courante_in
residence = smic_in.residence_in
try:
def temp_brut_horaire(_:Any):
def temp_brut_horaire(_:Unit):
raise EmptyError
def temp_brut_horaire_1(_:Any):
def temp_brut_horaire_1(_:Unit):
return False
def temp_brut_horaire_2(_:Any):
def temp_brut_horaire_2(_:Unit):
if ((date_courante >= date_of_numbers(2022,5,1)) and
((date_courante <= date_of_numbers(2022,12,31)) and
(residence == Collectivite(Collectivite_Code.Mayotte,
@ -557,7 +557,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("819")
else:
raise EmptyError
def temp_brut_horaire_3(_:Any):
def temp_brut_horaire_3(_:Unit):
if ((date_courante >= date_of_numbers(2022,5,1)) and
((date_courante <= date_of_numbers(2022,12,31)) and
((residence == Collectivite(Collectivite_Code.Metropole,
@ -576,7 +576,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("1085")
else:
raise EmptyError
def temp_brut_horaire_4(_:Any):
def temp_brut_horaire_4(_:Unit):
if ((date_courante >= date_of_numbers(2022,1,1)) and
((date_courante <= date_of_numbers(2022,4,30)) and
(residence == Collectivite(Collectivite_Code.Mayotte,
@ -584,7 +584,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("798")
else:
raise EmptyError
def temp_brut_horaire_5(_:Any):
def temp_brut_horaire_5(_:Unit):
if ((date_courante >= date_of_numbers(2022,1,1)) and
((date_courante <= date_of_numbers(2022,4,30)) and
((residence == Collectivite(Collectivite_Code.Metropole,
@ -603,7 +603,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("1057")
else:
raise EmptyError
def temp_brut_horaire_6(_:Any):
def temp_brut_horaire_6(_:Unit):
if ((date_courante >= date_of_numbers(2021,1,1)) and
((date_courante <= date_of_numbers(2021,12,31)) and
(residence == Collectivite(Collectivite_Code.Mayotte,
@ -611,7 +611,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("774")
else:
raise EmptyError
def temp_brut_horaire_7(_:Any):
def temp_brut_horaire_7(_:Unit):
if ((date_courante >= date_of_numbers(2021,1,1)) and
((date_courante <= date_of_numbers(2021,12,31)) and
((residence == Collectivite(Collectivite_Code.Metropole,
@ -630,7 +630,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("1025")
else:
raise EmptyError
def temp_brut_horaire_8(_:Any):
def temp_brut_horaire_8(_:Unit):
if ((date_courante >= date_of_numbers(2020,1,1)) and
((date_courante <= date_of_numbers(2020,12,31)) and
(residence == Collectivite(Collectivite_Code.Mayotte,
@ -638,7 +638,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("766")
else:
raise EmptyError
def temp_brut_horaire_9(_:Any):
def temp_brut_horaire_9(_:Unit):
if ((date_courante >= date_of_numbers(2020,1,1)) and
((date_courante <= date_of_numbers(2020,12,31)) and
((residence == Collectivite(Collectivite_Code.Metropole,
@ -657,7 +657,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("1015")
else:
raise EmptyError
def temp_brut_horaire_10(_:Any):
def temp_brut_horaire_10(_:Unit):
if ((date_courante >= date_of_numbers(2019,1,1)) and
((date_courante <= date_of_numbers(2019,12,31)) and
(residence == Collectivite(Collectivite_Code.Mayotte,
@ -665,7 +665,7 @@ def smic(smic_in:SmicIn):
return money_of_cents_string("757")
else:
raise EmptyError
def temp_brut_horaire_11(_:Any):
def temp_brut_horaire_11(_:Unit):
if ((date_courante >= date_of_numbers(2019,1,1)) and
((date_courante <= date_of_numbers(2019,12,31)) and
((residence == Collectivite(Collectivite_Code.Metropole,
@ -713,32 +713,32 @@ def smic(smic_in:SmicIn):
def base_mensuelle_allocations_familiales(base_mensuelle_allocations_familiales_in:BaseMensuelleAllocationsFamilialesIn):
date_courante_1 = base_mensuelle_allocations_familiales_in.date_courante_in
try:
def temp_montant(_:Any):
def temp_montant(_:Unit):
raise EmptyError
def temp_montant_1(_:Any):
def temp_montant_1(_:Unit):
return False
def temp_montant_2(_:Any):
def temp_montant_2(_:Unit):
if ((date_courante_1 >= date_of_numbers(2022,4,1)) and
(date_courante_1 <
date_of_numbers(2023,4,1))):
return money_of_cents_string("42228")
else:
raise EmptyError
def temp_montant_3(_:Any):
def temp_montant_3(_:Unit):
if ((date_courante_1 >= date_of_numbers(2021,4,1)) and
(date_courante_1 <
date_of_numbers(2022,4,1))):
return money_of_cents_string("41481")
else:
raise EmptyError
def temp_montant_4(_:Any):
def temp_montant_4(_:Unit):
if ((date_courante_1 >= date_of_numbers(2020,4,1)) and
(date_courante_1 <
date_of_numbers(2021,4,1))):
return money_of_cents_string("41440")
else:
raise EmptyError
def temp_montant_5(_:Any):
def temp_montant_5(_:Unit):
if ((date_courante_1 >= date_of_numbers(2019,4,1)) and
(date_courante_1 <
date_of_numbers(2020,4,1))):
@ -999,11 +999,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
try:
def temp_prise_en_compte(param_2:Enfant):
try:
def temp_prise_en_compte_1(_:Any):
def temp_prise_en_compte_1(_:Unit):
raise EmptyError
def temp_prise_en_compte_2(_:Any):
def temp_prise_en_compte_2(_:Unit):
return False
def temp_prise_en_compte_3(_:Any):
def temp_prise_en_compte_3(_:Unit):
try:
try:
match_arg_6 = param_2.prise_en_charge
@ -1071,7 +1071,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
Unit())
else:
raise EmptyError
def temp_prise_en_compte_7(_:Any):
def temp_prise_en_compte_7(_:Unit):
match_arg_9 = param_2.prise_en_charge
if match_arg_9.code == PriseEnCharge_Code.GardeAlterneePartageAllocations:
_ = match_arg_9.value
@ -1092,7 +1092,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return PriseEnCompte(PriseEnCompte_Code.Zero, Unit())
else:
raise EmptyError
def temp_prise_en_compte_9(_:Any):
def temp_prise_en_compte_9(_:Unit):
match_arg_10 = param_2.prise_en_charge
if match_arg_10.code == PriseEnCharge_Code.GardeAlterneePartageAllocations:
_ = match_arg_10.value
@ -1145,11 +1145,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
try:
def temp_versement(param_3:Enfant):
try:
def temp_versement_1(_:Any):
def temp_versement_1(_:Unit):
raise EmptyError
def temp_versement_2(_:Any):
def temp_versement_2(_:Unit):
return False
def temp_versement_3(_:Any):
def temp_versement_3(_:Unit):
try:
try:
try:
@ -1240,7 +1240,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
Unit())
else:
raise EmptyError
def temp_versement_8(_:Any):
def temp_versement_8(_:Unit):
match_arg_15 = param_3.prise_en_charge
if match_arg_15.code == PriseEnCharge_Code.GardeAlterneePartageAllocations:
_ = match_arg_15.value
@ -1445,11 +1445,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
est_enfant_le_plus_age = temp_est_enfant_le_plus_age
try:
try:
def temp_plafond__i_i_d521_3(_:Any):
def temp_plafond__i_i_d521_3(_:Unit):
raise EmptyError
def temp_plafond__i_i_d521_3_1(_:Any):
def temp_plafond__i_i_d521_3_1(_:Unit):
return False
def temp_plafond__i_i_d521_3_2(_:Any):
def temp_plafond__i_i_d521_3_2(_:Unit):
if ((date_courante_3 >= date_of_numbers(2021,1,1)) and
(date_courante_3 <=
date_of_numbers(2021,12,31))):
@ -1458,7 +1458,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_integer(list_length(enfants_a_charge_droit_ouvert_prestation_familiale))))
else:
raise EmptyError
def temp_plafond__i_i_d521_3_3(_:Any):
def temp_plafond__i_i_d521_3_3(_:Unit):
if ((date_courante_3 >= date_of_numbers(2020,1,1)) and
(date_courante_3 <=
date_of_numbers(2020,12,31))):
@ -1467,7 +1467,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_integer(list_length(enfants_a_charge_droit_ouvert_prestation_familiale))))
else:
raise EmptyError
def temp_plafond__i_i_d521_3_4(_:Any):
def temp_plafond__i_i_d521_3_4(_:Unit):
if ((date_courante_3 >= date_of_numbers(2019,1,1)) and
(date_courante_3 <=
date_of_numbers(2019,12,31))):
@ -1476,7 +1476,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_integer(list_length(enfants_a_charge_droit_ouvert_prestation_familiale))))
else:
raise EmptyError
def temp_plafond__i_i_d521_3_5(_:Any):
def temp_plafond__i_i_d521_3_5(_:Unit):
if ((date_courante_3 >= date_of_numbers(2018,1,1)) and
(date_courante_3 <=
date_of_numbers(2018,12,31))):
@ -1512,11 +1512,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
plafond__i_i_d521_3 = temp_plafond__i_i_d521_3_6
try:
try:
def temp_plafond__i_d521_3(_:Any):
def temp_plafond__i_d521_3(_:Unit):
raise EmptyError
def temp_plafond__i_d521_3_1(_:Any):
def temp_plafond__i_d521_3_1(_:Unit):
return False
def temp_plafond__i_d521_3_2(_:Any):
def temp_plafond__i_d521_3_2(_:Unit):
if ((date_courante_3 >= date_of_numbers(2021,1,1)) and
(date_courante_3 <=
date_of_numbers(2021,12,31))):
@ -1525,7 +1525,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_integer(list_length(enfants_a_charge_droit_ouvert_prestation_familiale))))
else:
raise EmptyError
def temp_plafond__i_d521_3_3(_:Any):
def temp_plafond__i_d521_3_3(_:Unit):
if ((date_courante_3 >= date_of_numbers(2020,1,1)) and
(date_courante_3 <=
date_of_numbers(2020,12,31))):
@ -1534,7 +1534,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_integer(list_length(enfants_a_charge_droit_ouvert_prestation_familiale))))
else:
raise EmptyError
def temp_plafond__i_d521_3_4(_:Any):
def temp_plafond__i_d521_3_4(_:Unit):
if ((date_courante_3 >= date_of_numbers(2019,1,1)) and
(date_courante_3 <=
date_of_numbers(2019,12,31))):
@ -1543,7 +1543,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_integer(list_length(enfants_a_charge_droit_ouvert_prestation_familiale))))
else:
raise EmptyError
def temp_plafond__i_d521_3_5(_:Any):
def temp_plafond__i_d521_3_5(_:Unit):
if ((date_courante_3 >= date_of_numbers(2018,1,1)) and
(date_courante_3 <=
date_of_numbers(2018,12,31))):
@ -1664,11 +1664,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
montant_initial_base_quatrieme_enfant_et_plus_mayotte = temp_montant_initial_base_quatrieme_enfant_et_plus_mayotte
try:
try:
def temp_montant_initial_base_troisieme_enfant_mayotte(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte(_:Unit):
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_1(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_1(_:Unit):
return False
def temp_montant_initial_base_troisieme_enfant_mayotte_2(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_2(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2020,1,1)) and (date_courante_3 <=
@ -1681,7 +1681,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_3(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_3(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2019,1,1)) and (date_courante_3 <=
@ -1694,7 +1694,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_4(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_4(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2018,1,1)) and (date_courante_3 <=
@ -1707,7 +1707,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_5(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_5(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2017,1,1)) and (date_courante_3 <=
@ -1720,7 +1720,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_6(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_6(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2016,1,1)) and (date_courante_3 <=
@ -1733,7 +1733,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_7(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_7(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2015,1,1)) and (date_courante_3 <=
@ -1746,7 +1746,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_8(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_8(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2014,1,1)) and (date_courante_3 <=
@ -1759,7 +1759,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_9(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_9(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2013,1,1)) and (date_courante_3 <=
@ -1772,7 +1772,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_10(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_10(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2012,1,1)) and (date_courante_3 <=
@ -1785,7 +1785,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_mayotte_11(_:Any):
def temp_montant_initial_base_troisieme_enfant_mayotte_11(_:Unit):
if ((residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())) and ((date_courante_3 >=
date_of_numbers(2011,1,1)) and (date_courante_3 <=
@ -1868,24 +1868,24 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
"Prologue"]))
nombre_moyen_enfants = temp_nombre_moyen_enfants_2
try:
def temp_montant_initial_base_premier_enfant(_:Any):
def temp_montant_initial_base_premier_enfant(_:Unit):
return money_of_cents_string("0")
def temp_montant_initial_base_premier_enfant_1(_:Any):
def temp_montant_initial_base_premier_enfant_1(_:Unit):
return True
def temp_montant_initial_base_premier_enfant_2(_:Any):
def temp_montant_initial_base_premier_enfant_2(_:Unit):
if (prestations_familiales_dot_regime_outre_mer_l751_1 and
(list_length(enfants_a_charge_droit_ouvert_prestation_familiale) ==
integer_of_string("1"))):
return (bmaf_dot_montant * decimal_of_string("0.0588"))
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_3(_:Any):
def temp_montant_initial_base_premier_enfant_3(_:Unit):
try:
def temp_montant_initial_base_premier_enfant_4(_:Any):
def temp_montant_initial_base_premier_enfant_4(_:Unit):
raise EmptyError
def temp_montant_initial_base_premier_enfant_5(_:Any):
def temp_montant_initial_base_premier_enfant_5(_:Unit):
return False
def temp_montant_initial_base_premier_enfant_6(_:Any):
def temp_montant_initial_base_premier_enfant_6(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
avait_enfant_a_charge_avant_1er_janvier_2012):
@ -1896,7 +1896,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_7(_:Any):
def temp_montant_initial_base_premier_enfant_7(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2020,1,1)) and
@ -1910,7 +1910,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_8(_:Any):
def temp_montant_initial_base_premier_enfant_8(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2019,1,1)) and
@ -1924,7 +1924,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_9(_:Any):
def temp_montant_initial_base_premier_enfant_9(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2018,1,1)) and
@ -1938,7 +1938,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_10(_:Any):
def temp_montant_initial_base_premier_enfant_10(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2017,1,1)) and
@ -1952,7 +1952,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_11(_:Any):
def temp_montant_initial_base_premier_enfant_11(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2016,1,1)) and
@ -1966,7 +1966,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_12(_:Any):
def temp_montant_initial_base_premier_enfant_12(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2015,1,1)) and
@ -1980,7 +1980,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_13(_:Any):
def temp_montant_initial_base_premier_enfant_13(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2014,1,1)) and
@ -1994,7 +1994,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_14(_:Any):
def temp_montant_initial_base_premier_enfant_14(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2013,1,1)) and
@ -2008,7 +2008,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_15(_:Any):
def temp_montant_initial_base_premier_enfant_15(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2012,1,1)) and
@ -2022,7 +2022,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_premier_enfant_16(_:Any):
def temp_montant_initial_base_premier_enfant_16(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2011,1,1)) and
@ -2165,11 +2165,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
def temp_complement_degressif(param_8:Money):
try:
try:
def temp_complement_degressif_1(_:Any):
def temp_complement_degressif_1(_:Unit):
raise EmptyError
def temp_complement_degressif_2(_:Any):
def temp_complement_degressif_2(_:Unit):
return False
def temp_complement_degressif_3(_:Any):
def temp_complement_degressif_3(_:Unit):
if ((ressources_menage > plafond__i_i_d521_3) and
(ressources_menage <= (plafond__i_i_d521_3 +
(param_8 *
@ -2181,7 +2181,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_string("12.")))
else:
raise EmptyError
def temp_complement_degressif_4(_:Any):
def temp_complement_degressif_4(_:Unit):
if ((ressources_menage > plafond__i_d521_3) and
(ressources_menage <= (plafond__i_d521_3 +
(param_8 *
@ -2223,24 +2223,24 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
"Prologue"]))
complement_degressif = temp_complement_degressif
try:
def temp_montant_verse_forfaitaire_par_enfant(_:Any):
def temp_montant_verse_forfaitaire_par_enfant(_:Unit):
raise EmptyError
def temp_montant_verse_forfaitaire_par_enfant_1(_:Any):
def temp_montant_verse_forfaitaire_par_enfant_1(_:Unit):
return False
def temp_montant_verse_forfaitaire_par_enfant_2(_:Any):
def temp_montant_verse_forfaitaire_par_enfant_2(_:Unit):
if (ressources_menage >
plafond__i_i_d521_3):
return (bmaf_dot_montant * decimal_of_string("0.05059"))
else:
raise EmptyError
def temp_montant_verse_forfaitaire_par_enfant_3(_:Any):
def temp_montant_verse_forfaitaire_par_enfant_3(_:Unit):
if ((ressources_menage > plafond__i_d521_3) and
(ressources_menage <=
plafond__i_i_d521_3)):
return (bmaf_dot_montant * decimal_of_string("0.10117"))
else:
raise EmptyError
def temp_montant_verse_forfaitaire_par_enfant_4(_:Any):
def temp_montant_verse_forfaitaire_par_enfant_4(_:Unit):
if (ressources_menage <=
plafond__i_d521_3):
return (bmaf_dot_montant * decimal_of_string("0.20234"))
@ -2265,11 +2265,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
"Prologue"]))
montant_verse_forfaitaire_par_enfant = temp_montant_verse_forfaitaire_par_enfant_5
try:
def temp_montant_initial_base_troisieme_enfant_et_plus(_:Any):
def temp_montant_initial_base_troisieme_enfant_et_plus(_:Unit):
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_et_plus_1(_:Any):
def temp_montant_initial_base_troisieme_enfant_et_plus_1(_:Unit):
return False
def temp_montant_initial_base_troisieme_enfant_et_plus_2(_:Any):
def temp_montant_initial_base_troisieme_enfant_et_plus_2(_:Unit):
if (ressources_menage >
plafond__i_i_d521_3):
if (list_length(enfants_a_charge_droit_ouvert_prestation_familiale) >
@ -2282,7 +2282,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_et_plus_3(_:Any):
def temp_montant_initial_base_troisieme_enfant_et_plus_3(_:Unit):
if ((ressources_menage > plafond__i_d521_3) and
(ressources_menage <=
plafond__i_i_d521_3)):
@ -2295,7 +2295,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_troisieme_enfant_et_plus_4(_:Any):
def temp_montant_initial_base_troisieme_enfant_et_plus_4(_:Unit):
if (ressources_menage <=
plafond__i_d521_3):
if (list_length(enfants_a_charge_droit_ouvert_prestation_familiale) >
@ -2328,11 +2328,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
try:
try:
try:
def temp_montant_initial_base_deuxieme_enfant(_:Any):
def temp_montant_initial_base_deuxieme_enfant(_:Unit):
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_1(_:Any):
def temp_montant_initial_base_deuxieme_enfant_1(_:Unit):
return False
def temp_montant_initial_base_deuxieme_enfant_2(_:Any):
def temp_montant_initial_base_deuxieme_enfant_2(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2020,1,1)) and
@ -2346,7 +2346,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_3(_:Any):
def temp_montant_initial_base_deuxieme_enfant_3(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2019,1,1)) and
@ -2360,7 +2360,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_4(_:Any):
def temp_montant_initial_base_deuxieme_enfant_4(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2018,1,1)) and
@ -2374,7 +2374,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_5(_:Any):
def temp_montant_initial_base_deuxieme_enfant_5(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2017,1,1)) and
@ -2388,7 +2388,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_6(_:Any):
def temp_montant_initial_base_deuxieme_enfant_6(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2016,1,1)) and
@ -2402,7 +2402,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_7(_:Any):
def temp_montant_initial_base_deuxieme_enfant_7(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2015,1,1)) and
@ -2416,7 +2416,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_8(_:Any):
def temp_montant_initial_base_deuxieme_enfant_8(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2014,1,1)) and
@ -2430,7 +2430,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_9(_:Any):
def temp_montant_initial_base_deuxieme_enfant_9(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2013,1,1)) and
@ -2444,7 +2444,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_10(_:Any):
def temp_montant_initial_base_deuxieme_enfant_10(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2012,1,1)) and
@ -2458,7 +2458,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_11(_:Any):
def temp_montant_initial_base_deuxieme_enfant_11(_:Unit):
if ((residence_2 ==
Collectivite(Collectivite_Code.Mayotte, Unit())) and
((date_courante_3 >= date_of_numbers(2011,1,1)) and
@ -2503,11 +2503,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
temp_montant_initial_base_deuxieme_enfant_12 = dead_value
raise EmptyError
except EmptyError:
def temp_montant_initial_base_deuxieme_enfant_13(_:Any):
def temp_montant_initial_base_deuxieme_enfant_13(_:Unit):
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_14(_:Any):
def temp_montant_initial_base_deuxieme_enfant_14(_:Unit):
return False
def temp_montant_initial_base_deuxieme_enfant_15(_:Any):
def temp_montant_initial_base_deuxieme_enfant_15(_:Unit):
if (ressources_menage >
plafond__i_i_d521_3):
if (list_length(enfants_a_charge_droit_ouvert_prestation_familiale) >
@ -2517,7 +2517,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_16(_:Any):
def temp_montant_initial_base_deuxieme_enfant_16(_:Unit):
if ((ressources_menage > plafond__i_d521_3) and
(ressources_menage <=
plafond__i_i_d521_3)):
@ -2528,7 +2528,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_base_deuxieme_enfant_17(_:Any):
def temp_montant_initial_base_deuxieme_enfant_17(_:Unit):
if (ressources_menage <=
plafond__i_d521_3):
if (list_length(enfants_a_charge_droit_ouvert_prestation_familiale) >
@ -2576,29 +2576,29 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
try:
def temp_montant_initial_metropole_majoration(param_9:Enfant):
try:
def temp_montant_initial_metropole_majoration_1(_:Any):
def temp_montant_initial_metropole_majoration_1(_:Unit):
raise EmptyError
def temp_montant_initial_metropole_majoration_2(_:Any):
def temp_montant_initial_metropole_majoration_2(_:Unit):
return False
def temp_montant_initial_metropole_majoration_3(_:Any):
def temp_montant_initial_metropole_majoration_3(_:Unit):
if not droit_ouvert_majoration(param_9):
return money_of_cents_string("0")
else:
raise EmptyError
def temp_montant_initial_metropole_majoration_4(_:Any):
def temp_montant_initial_metropole_majoration_4(_:Unit):
if ((ressources_menage > plafond__i_i_d521_3) and
droit_ouvert_majoration(param_9)):
return (bmaf_dot_montant * decimal_of_string("0.04"))
else:
raise EmptyError
def temp_montant_initial_metropole_majoration_5(_:Any):
def temp_montant_initial_metropole_majoration_5(_:Unit):
if (((ressources_menage > plafond__i_d521_3) and
(ressources_menage <= plafond__i_i_d521_3)) and
droit_ouvert_majoration(param_9)):
return (bmaf_dot_montant * decimal_of_string("0.08"))
else:
raise EmptyError
def temp_montant_initial_metropole_majoration_6(_:Any):
def temp_montant_initial_metropole_majoration_6(_:Unit):
if ((ressources_menage <= plafond__i_d521_3) and
droit_ouvert_majoration(param_9)):
return (bmaf_dot_montant * decimal_of_string("0.16"))
@ -2654,11 +2654,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
montant_verse_forfaitaire = temp_montant_verse_forfaitaire_1
try:
try:
def temp_montant_initial_base(_:Any):
def temp_montant_initial_base(_:Unit):
raise EmptyError
def temp_montant_initial_base_1(_:Any):
def temp_montant_initial_base_1(_:Unit):
return False
def temp_montant_initial_base_2(_:Any):
def temp_montant_initial_base_2(_:Unit):
if (residence_2 == Collectivite(Collectivite_Code.Mayotte,
Unit())):
return (((montant_initial_base_premier_enfant +
@ -2667,7 +2667,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
montant_initial_base_quatrieme_enfant_et_plus_mayotte)
else:
raise EmptyError
def temp_montant_initial_base_3(_:Any):
def temp_montant_initial_base_3(_:Unit):
if (prestations_familiales_dot_regime_outre_mer_l751_1 and
(list_length(enfants_a_charge_droit_ouvert_prestation_familiale) ==
integer_of_string("1"))):
@ -2700,11 +2700,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
def temp_montant_initial_majoration(param_10:Enfant):
try:
try:
def temp_montant_initial_majoration_1(_:Any):
def temp_montant_initial_majoration_1(_:Unit):
raise EmptyError
def temp_montant_initial_majoration_2(_:Any):
def temp_montant_initial_majoration_2(_:Unit):
return False
def temp_montant_initial_majoration_3(_:Any):
def temp_montant_initial_majoration_3(_:Unit):
if (droit_ouvert_majoration(param_10) and
(prestations_familiales_dot_regime_outre_mer_l751_1 and
((list_length(enfants_a_charge_droit_ouvert_prestation_familiale) ==
@ -2716,7 +2716,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
decimal_of_string("0.0567"))
else:
raise EmptyError
def temp_montant_initial_majoration_4(_:Any):
def temp_montant_initial_majoration_4(_:Unit):
if (droit_ouvert_majoration(param_10) and
(prestations_familiales_dot_regime_outre_mer_l751_1 and
((list_length(enfants_a_charge_droit_ouvert_prestation_familiale) ==
@ -2762,11 +2762,11 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
montant_initial_majoration = temp_montant_initial_majoration
try:
try:
def temp_montant_verse_complement_pour_forfaitaire(_:Any):
def temp_montant_verse_complement_pour_forfaitaire(_:Unit):
raise EmptyError
def temp_montant_verse_complement_pour_forfaitaire_1(_:Any):
def temp_montant_verse_complement_pour_forfaitaire_1(_:Unit):
return False
def temp_montant_verse_complement_pour_forfaitaire_2(_:Any):
def temp_montant_verse_complement_pour_forfaitaire_2(_:Unit):
if ((ressources_menage > plafond__i_i_d521_3) and
(ressources_menage <= (plafond__i_i_d521_3 +
(montant_verse_forfaitaire *
@ -2777,7 +2777,7 @@ def allocations_familiales(allocations_familiales_in:AllocationsFamilialesIn):
(decimal_of_string("1.") / decimal_of_string("12.")))
else:
raise EmptyError
def temp_montant_verse_complement_pour_forfaitaire_3(_:Any):
def temp_montant_verse_complement_pour_forfaitaire_3(_:Unit):
if ((ressources_menage > plafond__i_d521_3) and
(ressources_menage <= (plafond__i_d521_3 +
(montant_verse_forfaitaire *

View File

@ -48,14 +48,14 @@ let scope_a (scope_a_in: ScopeAIn.t) : ScopeAOut.t =
(handle_default
{filename = "tests/test_scope/good/191_fix_record_name_confusion.catala_en";
start_line=5; start_column=18; end_line=5; end_column=19;
law_headings=["Article"]} ([|(fun (_: _) -> a_ ())|])
(fun (_: _) -> true)
(fun (_: _) ->
law_headings=["Article"]} ([|(fun (_: unit) -> a_ ())|])
(fun (_: unit) -> true)
(fun (_: unit) ->
handle_default
{filename = "tests/test_scope/good/191_fix_record_name_confusion.catala_en";
start_line=5; start_column=18; end_line=5; end_column=19;
law_headings=["Article"]} ([||]) (fun (_: _) -> true)
(fun (_: _) -> true)))
law_headings=["Article"]} ([||]) (fun (_: unit) -> true)
(fun (_: unit) -> true)))
with
EmptyError -> (raise (NoValueProvided
{filename = "tests/test_scope/good/191_fix_record_name_confusion.catala_en";
@ -73,14 +73,14 @@ let scope_b (scope_b_in: ScopeBIn.t) : ScopeBOut.t =
(handle_default
{filename = "tests/test_scope/good/191_fix_record_name_confusion.catala_en";
start_line=8; start_column=11; end_line=8; end_column=12;
law_headings=["Article"]} ([|(fun (_: _) -> a_ ())|])
(fun (_: _) -> true)
(fun (_: _) ->
law_headings=["Article"]} ([|(fun (_: unit) -> a_ ())|])
(fun (_: unit) -> true)
(fun (_: unit) ->
handle_default
{filename = "tests/test_scope/good/191_fix_record_name_confusion.catala_en";
start_line=8; start_column=11; end_line=8; end_column=12;
law_headings=["Article"]} ([||]) (fun (_: _) -> true)
(fun (_: _) -> scope_a_dot_a_)))
law_headings=["Article"]} ([||]) (fun (_: unit) -> true)
(fun (_: unit) -> scope_a_dot_a_)))
with
EmptyError -> (raise (NoValueProvided
{filename = "tests/test_scope/good/191_fix_record_name_confusion.catala_en";

View File

@ -14,7 +14,7 @@ let Foo =
λ (Foo_in_27: Foo_in{}) →
let bar_28 : integer =
try
handle_default_0 [] (λ (__29: any) → true) (λ (__30: any) → 0)
with EmptyError -> raise NoValueProvided in
handle_default_0 [] (λ (__29: unit) → true)
(λ (__30: unit) → 0) with EmptyError -> raise NoValueProvided in
Foo_out {"bar_out"= bar_28}
```