mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fix default typing across modules
This commit is contained in:
parent
9203e4f7bb
commit
fd50e6186f
@ -837,16 +837,17 @@ let translate_program
|
||||
let ctx = make_ctx desugared in
|
||||
let rec gather_scope_vars acc modules =
|
||||
ModuleName.Map.fold
|
||||
(fun _modname mctx acc ->
|
||||
let acc = gather_scope_vars acc mctx.modules in
|
||||
ScopeVar.Map.union (fun _ _ -> assert false) acc mctx.scope_var_mapping)
|
||||
(fun _modname mctx (vmap, reentr) ->
|
||||
let vmap, reentr = gather_scope_vars (vmap, reentr) mctx.modules in
|
||||
ScopeVar.Map.union (fun _ _ -> assert false) vmap mctx.scope_var_mapping,
|
||||
ScopeVar.Map.union (fun _ _ -> assert false) reentr mctx.reentrant_vars)
|
||||
modules acc
|
||||
in
|
||||
let ctx =
|
||||
{
|
||||
ctx with
|
||||
scope_var_mapping = gather_scope_vars ctx.scope_var_mapping ctx.modules;
|
||||
}
|
||||
let scope_var_mapping, reentrant_vars =
|
||||
gather_scope_vars (ctx.scope_var_mapping, ctx.reentrant_vars) ctx.modules
|
||||
in
|
||||
{ ctx with scope_var_mapping; reentrant_vars }
|
||||
in
|
||||
let rec process_decl_ctx ctx decl_ctx =
|
||||
let ctx_scopes =
|
||||
|
@ -522,6 +522,7 @@ and val_to_runtime :
|
||||
curry (runtime_to_val eval_expr ctx m targ x :: acc) targs)
|
||||
in
|
||||
curry [] targs
|
||||
| TDefault ty, _ -> val_to_runtime eval_expr ctx ty v
|
||||
| _ ->
|
||||
Message.raise_internal_error
|
||||
"Could not convert value of type %a to runtime: %a" (Print.typ ctx) ty
|
||||
|
Loading…
Reference in New Issue
Block a user