@@ -90,6 +90,9 @@ let decl_universe env sigma = function
9090 | CompactedDecl. LocalAssum (_ , typ ) -> hypothesis_universe env sigma typ
9191 | CompactedDecl. LocalDef (_ , _ , typ ) -> hypothesis_universe env sigma typ
9292
93+ let ids_of_decl decl =
94+ List. map (fun id -> Pp. string_of_ppcmds @@ Ppconstr. pr_id id) (get_ids decl)
95+
9396let mk_hypothesis env sigma d =
9497 let pbody, typ = match d with
9598 | CompactedDecl. LocalAssum (_ , typ ) -> None , typ
@@ -98,10 +101,8 @@ let mk_hypothesis env sigma d =
98101 let pb = if EConstr. isCast sigma c then Pp. surround pb else pb in
99102 Some pb, typ
100103 in
101- let ids =
102- List. map (fun id -> Pp. string_of_ppcmds @@ Ppconstr. pr_id id) (get_ids d) in
103104 {
104- ids;
105+ ids = ids_of_decl d ;
105106 body = Option. map pp_of_rocqpp pbody;
106107 _type = pp_of_rocqpp (pr_letype_env env sigma typ);
107108 universe = decl_universe env sigma d;
@@ -115,15 +116,22 @@ let mk_fallback_hypothesis hyp = {
115116}
116117
117118let add_diff_hypotheses_info env sigma hyps =
118- let compacted = compact sigma env in
119- let rec zip decls hps =
120- match decls, hps with
121- | [] , [] -> []
122- | d :: ds , h :: hs ->
123- { (mk_fallback_hypothesis h) with ids = List. map (fun id -> Pp. string_of_ppcmds @@ Ppconstr. pr_id id) (get_ids d); universe = decl_universe env sigma d } :: zip ds hs
124- | _ -> List. map mk_fallback_hypothesis hyps
119+ (* The proof-diff API gives us already-rendered hypotheses. We try to match them
120+ against the current compacted context to recover ids and universe
121+ information; if the shapes do not line up, keep the rendered diff hypotheses
122+ and leave the extra metadata empty. *)
123+ let enrich_hypothesis decl hyp =
124+ {
125+ (mk_fallback_hypothesis hyp) with
126+ ids = ids_of_decl decl;
127+ universe = decl_universe env sigma decl;
128+ }
125129 in
126- zip compacted hyps
130+ let compacted = compact sigma env in
131+ if List. length hyps <> List. length compacted then
132+ List. map mk_fallback_hypothesis hyps
133+ else
134+ List. map2 enrich_hypothesis compacted hyps
127135
128136let mk_goal env sigma g =
129137 let EvarInfo evi = Evd. find sigma g in
0 commit comments