Skip to content

Commit 9c5fd9f

Browse files
authored
Merge pull request #132 from ppedrot/module-remove-modpath
Adapt w.r.t. rocq-prover/rocq#20060.
2 parents 3562200 + 7b6c8f8 commit 9c5fd9f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/declare_translation.ml

+8-5
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,14 @@ let rec list_continuation final f l _ = match l with [] -> final ()
199199
let rec translate_module_command ~opaque_access ?name arity r =
200200
check_nothing_ongoing ();
201201
let qid = r in
202-
let mb = try Global.lookup_module (Nametab.locate_module qid)
202+
let mp, mb =
203+
try
204+
let mp = Nametab.locate_module qid in
205+
let mb = Global.lookup_module mp in
206+
mp, mb
203207
with Not_found -> error Pp.(str "Unknown Module " ++ pr_qualid qid)
204208
in
205-
declare_module ~opaque_access ?name arity mb
209+
declare_module ~opaque_access ?name arity mp mb
206210

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

215-
and declare_module ~opaque_access ?(continuation = ignore) ?name arity mb =
219+
and declare_module ~opaque_access ?(continuation = ignore) ?name arity mp mb =
216220
debug_string [`Module] "--> declare_module";
217221
let open Declarations in
218-
let mp = Mod_declarations.mod_mp mb in
219222
match Mod_declarations.mod_expr mb, Mod_declarations.mod_type mb with
220223
| Algebraic _, NoFunctor fields
221224
| FullStruct, NoFunctor fields ->
@@ -302,7 +305,7 @@ and declare_module ~opaque_access ?(continuation = ignore) ?name arity mb =
302305
(match Mod_declarations.mod_expr mb' with FullStruct | Algebraic _ -> true | _ -> false)
303306
| _ -> false
304307
->
305-
declare_module ~opaque_access ~continuation arity mb'
308+
declare_module ~opaque_access ~continuation arity (MPdot (mp, lab)) mb'
306309

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

0 commit comments

Comments
 (0)