Fix bug in bindlib use

This is a workaround (but corresponds to what was executed before) and means
that we re-explore all exprs to look for free variables.

The proper fix will be to store boxed_exprs inside scopes instead.
This commit is contained in:
Louis Gesbert 2022-10-07 15:47:03 +02:00
parent e925ec1795
commit 7bcafa4ead
2 changed files with 4 additions and 3 deletions

View File

@ -114,7 +114,7 @@ let get_body_mark scope_body =
let rec unfold_body_expr (ctx : decl_ctx) (scope_let : 'e scope_body_expr) =
match scope_let with
| Result e -> Expr.box e
| Result e -> Expr.rebox e
| ScopeLet
{
scope_let_kind = _;
@ -124,7 +124,8 @@ let rec unfold_body_expr (ctx : decl_ctx) (scope_let : 'e scope_body_expr) =
scope_let_pos;
} ->
let var, next = Bindlib.unbind scope_let_next in
Expr.make_let_in var scope_let_typ (Expr.box scope_let_expr)
Expr.make_let_in var scope_let_typ
(Expr.rebox scope_let_expr)
(unfold_body_expr ctx next)
scope_let_pos

View File

@ -20,7 +20,7 @@ Error coming from typechecking the following expression:
--> tests/test_array/bad/fold_error.catala_en
|
10 | definition list_high_count equals number for m in list of (m >=$ $7)
| ^
| ^^^^
+ Article
Type integer coming from expression: