mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fix faulty unboxing
This commit is contained in:
parent
522deb50c2
commit
b7c468bd1e
@ -146,8 +146,7 @@ let rec map_expr_top_down ~f e =
|
||||
map_expr () ~f:(fun () -> map_expr_top_down ~f) (f e)
|
||||
|
||||
let map_expr_marks ~f e =
|
||||
Bindlib.unbox
|
||||
@@ map_expr_top_down ~f:(fun e -> Marked.(mark (f (get_mark e)) (unmark e))) e
|
||||
map_expr_top_down ~f:(fun e -> Marked.(mark (f (get_mark e)) (unmark e))) e
|
||||
|
||||
let untype_expr e =
|
||||
map_expr_marks ~f:(fun m -> Untyped { pos = D.mark_pos m }) e
|
||||
@ -158,7 +157,7 @@ let untype_program prg =
|
||||
D.scopes =
|
||||
Bindlib.unbox
|
||||
(D.map_exprs_in_scopes
|
||||
~f:(fun e -> Bindlib.box (untype_expr e))
|
||||
~f:(fun e -> untype_expr e)
|
||||
~varf:translate_var prg.D.scopes);
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,10 @@ val map_expr_top_down :
|
||||
(** See [Dcalc.Ast.map_expr_top_down] *)
|
||||
|
||||
val map_expr_marks :
|
||||
f:('m1 mark -> 'm2 mark) -> 'm1 marked_expr -> 'm2 marked_expr
|
||||
f:('m1 mark -> 'm2 mark) -> 'm1 marked_expr -> 'm2 marked_expr Bindlib.box
|
||||
(** See [Dcalc.Ast.map_expr_marks] *)
|
||||
|
||||
val untype_expr : 'm marked_expr -> Dcalc.Ast.untyped marked_expr
|
||||
val untype_expr : 'm marked_expr -> Dcalc.Ast.untyped marked_expr Bindlib.box
|
||||
val untype_program : 'm program -> Dcalc.Ast.untyped program
|
||||
|
||||
(** {1 Boxed constructors} *)
|
||||
|
8
tests/test_scope/good/output/simple.catala_en.Lcalc
Normal file
8
tests/test_scope/good/output/simple.catala_en.Lcalc
Normal file
@ -0,0 +1,8 @@
|
||||
let Foo_29 : Foo_in{} → Foo_out{"bar_out": integer} =
|
||||
λ (Foo_in_30: Foo_in{}) →
|
||||
let bar_31 : integer =
|
||||
try
|
||||
handle_default_0 [] (λ (__32: any) → true) (λ (__33: any) → 0)
|
||||
with EmptyError -> raise NoValueProvided in
|
||||
Foo_out {"bar_out": bar_31} in
|
||||
Foo_29
|
13
tests/test_scope/good/simple.catala_en
Normal file
13
tests/test_scope/good/simple.catala_en
Normal file
@ -0,0 +1,13 @@
|
||||
## Test
|
||||
|
||||
```catala
|
||||
declaration scope Foo:
|
||||
output bar content integer
|
||||
|
||||
scope Foo:
|
||||
definition bar equals 0
|
||||
```
|
||||
|
||||
```catala-test {id="Lcalc"}
|
||||
catala Lcalc
|
||||
```
|
Loading…
Reference in New Issue
Block a user