From d09113163d353515c49f481864cebedc9c5f0a33 Mon Sep 17 00:00:00 2001 From: Louis Gesbert Date: Fri, 13 Oct 2023 15:09:00 +0200 Subject: [PATCH] Fix bug in dependency analysis around scope call arguments --- compiler/dcalc/from_scopelang.ml | 1 + compiler/scopelang/dependency.ml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/dcalc/from_scopelang.ml b/compiler/dcalc/from_scopelang.ml index 575d7810..da5e003d 100644 --- a/compiler/dcalc/from_scopelang.ml +++ b/compiler/dcalc/from_scopelang.ml @@ -1237,6 +1237,7 @@ let translate_program (prgm : 'm Scopelang.Ast.program) : 'm Ast.program = def next_bind in let items = translate_defs top_ctx defs_ordering in + Expr.Box.assert_closed items; { code_items = Bindlib.unbox items; decl_ctx; diff --git a/compiler/scopelang/dependency.ml b/compiler/scopelang/dependency.ml index 6ca56c77..c70234f4 100644 --- a/compiler/scopelang/dependency.ml +++ b/compiler/scopelang/dependency.ml @@ -86,7 +86,7 @@ let rec expr_used_defs e = if TopdefName.path v <> [] then VMap.empty else VMap.singleton (Topdef v) pos | (EScopeCall { scope; _ }, m) as e -> - if ScopeName.path scope <> [] then VMap.empty + if ScopeName.path scope <> [] then recurse_subterms e else VMap.add (Scope scope) (Expr.mark_pos m) (recurse_subterms e) | EAbs { binder; _ }, _ -> let _, body = Bindlib.unmbind binder in