Skip to content

Commit cc34440

Browse files
committed
Fix CClosure it_mk_Lambda putting the wrong env size
1 parent 3be9a09 commit cc34440

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernel/cClosure.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,17 @@ let subst_context env ctx =
613613
let subs = comp_subs el_id env in
614614
subst_context subs ctx
615615

616-
let it_mkLambda_or_LetIn ctx t =
616+
let it_mkLambda_or_LetIn infos ctx t =
617+
let l = Range.length (info_relevances infos) in
617618
let open Context.Rel.Declaration in
618619
match List.rev ctx with
619620
| [] -> t
620621
| LocalAssum (n, ty) :: ctx ->
621622
let assums, ctx = List.map_until (function LocalAssum (n, ty) -> Some (n, ty) | LocalDef _ -> None) ctx in
622623
let assums = (n, ty) :: assums in
623-
{ term = FLambda(List.length assums, assums, Term.it_mkLambda_or_LetIn (term_of_fconstr t) (List.rev ctx), (subs_id 0, UVars.Instance.empty)); mark = t.mark }
624+
{ term = FLambda(List.length assums, assums, Term.it_mkLambda_or_LetIn (term_of_fconstr t) (List.rev ctx), (subs_id l, UVars.Instance.empty)); mark = t.mark }
624625
| LocalDef _ :: _ ->
625-
mk_clos (subs_id 0, UVars.Instance.empty) (Term.it_mkLambda_or_LetIn (term_of_fconstr t) ctx)
626+
mk_clos (subs_id l, UVars.Instance.empty) (Term.it_mkLambda_or_LetIn (term_of_fconstr t) ctx)
626627

627628
(* fstrong applies unfreeze_fun recursively on the (freeze) term and
628629
* yields a term. Assumes that the unfreeze_fun never returns a
@@ -1661,7 +1662,7 @@ and match_elim : 'a. ('a, 'a patstate) reduction -> _ -> _ -> pat_state:(fconstr
16611662
and match_arg : 'a. ('a, 'a patstate) reduction -> _ -> _ -> pat_state:(fconstr, stack, _, 'a) depth -> _ -> _ -> _ -> _ -> _ -> 'a =
16621663
fun red info tab ~pat_state next context states patterns t ->
16631664
let match_deeper = ref false in
1664-
let t' = it_mkLambda_or_LetIn context t in
1665+
let t' = it_mkLambda_or_LetIn info context t in
16651666
let patterns, states = Array.split @@ Array.map2
16661667
(function Dead -> fun _ -> Ignore, Dead | (Live ({ subst; _ } as psubst) as state) -> function
16671668
| Ignore -> Ignore, state

0 commit comments

Comments
 (0)