@@ -656,22 +656,22 @@ let to_list v =
656656
657657(* if we make coq elaborate an arity, we get a type back. here we try to
658658 recoved an arity to pass that to elpi *)
659- let best_effort_recover_arity ~depth state typ bl =
660- let rec aux ~ depth state typ bl =
661- match bl with
662- | Constrexpr. CLocalAssum ( x :: y :: more , k , e ):: bl ->
663- aux ~depth state typ ( Constrexpr. CLocalAssum ([x],k,e) :: Constrexpr. CLocalAssum (y :: more,k,e) :: bl)
664- | Constrexpr. CLocalAssum ([ CAst. { v = name }],( Constrexpr. Default ik | Constrexpr. Generalized ( ik , _ )) ,_ ):: bl ->
665- begin match Coq_elpi_HOAS. is_prod ~depth typ with
666- | None -> state, in_elpi_arity typ
667- | Some (ty ,bo ) ->
668- let state, imp = in_elpi_imp ~depth state ik in
669- let state, bo = aux ~depth: (depth+ 1 ) state bo bl in
670- state, in_elpi_parameter name ~imp ty bo
671- end
659+ let best_effort_recover_arity ~depth state glob_sign typ bl =
660+ let _, grouped_bl = intern_global_context glob_sign ~intern_env: Constrintern. empty_internalization_env bl in
661+
662+ let rec aux ~ depth state typ gbl =
663+ match gbl with
664+ | ( name , ik , _ ,_ ) :: gbl ->
665+ begin match Coq_elpi_HOAS. is_prod ~depth typ with
666+ | None -> state, in_elpi_arity typ
667+ | Some (ty ,bo ) ->
668+ let state, imp = in_elpi_imp ~depth state ik in
669+ let state, bo = aux ~depth: (depth+ 1 ) state bo gbl in
670+ state, in_elpi_parameter name ~imp ty bo
671+ end
672672 | _ -> state, in_elpi_arity typ
673673 in
674- aux ~depth state typ bl
674+ aux ~depth state typ ( List. rev grouped_bl)
675675
676676let in_elpi_string_arg ~depth state x =
677677 state, E. mkApp strc (CD. of_string x) [] , []
@@ -796,7 +796,7 @@ let in_elpi_cmd ~depth ?calldepth coq_ctx state ~raw (x : Cmd.top) =
796796 let state, typ, gls1 = constr2lp_closed ~depth ?calldepth coq_ctx E. no_constraints state typ in
797797 let state, body, gls2 =
798798 option_map_acc2 (constr2lp_closed ~depth ?calldepth coq_ctx E. no_constraints) state body in
799- let state, typ = best_effort_recover_arity ~depth state typ bl in
799+ let state, typ = best_effort_recover_arity ~depth state glob_sign typ bl in
800800 let state, body, _ = in_option ~depth state body in
801801 let c = decl_name2lp (raw_decl_name_to_glob name) in
802802 begin match udecl with
0 commit comments