Skip to content

Commit

Permalink
Merge pull request #132 from ppedrot/module-remove-modpath
Browse files Browse the repository at this point in the history
Adapt w.r.t. coq/coq#20060.
  • Loading branch information
ppedrot authored Jan 15, 2025
2 parents 3562200 + 7b6c8f8 commit 9c5fd9f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/declare_translation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,14 @@ let rec list_continuation final f l _ = match l with [] -> final ()
let rec translate_module_command ~opaque_access ?name arity r =
check_nothing_ongoing ();
let qid = r in
let mb = try Global.lookup_module (Nametab.locate_module qid)
let mp, mb =
try
let mp = Nametab.locate_module qid in
let mb = Global.lookup_module mp in
mp, mb
with Not_found -> error Pp.(str "Unknown Module " ++ pr_qualid qid)
in
declare_module ~opaque_access ?name arity mb
declare_module ~opaque_access ?name arity mp mb

and id_of_module_path mp =
let open Names in
Expand All @@ -212,10 +216,9 @@ and id_of_module_path mp =
| MPfile dp -> List.hd (DirPath.repr dp)
| MPbound id -> MBId.to_id id

and declare_module ~opaque_access ?(continuation = ignore) ?name arity mb =
and declare_module ~opaque_access ?(continuation = ignore) ?name arity mp mb =
debug_string [`Module] "--> declare_module";
let open Declarations in
let mp = Mod_declarations.mod_mp mb in
match Mod_declarations.mod_expr mb, Mod_declarations.mod_type mb with
| Algebraic _, NoFunctor fields
| FullStruct, NoFunctor fields ->
Expand Down Expand Up @@ -302,7 +305,7 @@ and declare_module ~opaque_access ?(continuation = ignore) ?name arity mb =
(match Mod_declarations.mod_expr mb' with FullStruct | Algebraic _ -> true | _ -> false)
| _ -> false
->
declare_module ~opaque_access ~continuation arity mb'
declare_module ~opaque_access ~continuation arity (MPdot (mp, lab)) mb'

| (lab, _) ->
Pp.(Flags.if_verbose msg_info (str (Printf.sprintf "Ignoring field '%s'." (Names.Label.to_string lab))));
Expand Down

0 comments on commit 9c5fd9f

Please sign in to comment.