@@ -173,7 +173,7 @@ let map_summary f = function
173
173
| Env_value_unbound (s , u , r ) -> Env_value_unbound (f s, u, r)
174
174
| Env_module_unbound (s , u , r ) -> Env_module_unbound (f s, u, r)
175
175
176
- type address = Persistent_env .address =
176
+ type address =
177
177
| Aunit of Compilation_unit .t
178
178
| Alocal of Ident .t
179
179
| Adot of address * int
@@ -953,24 +953,34 @@ let components_of_module ~alerts ~uid env ps path addr mty shape =
953
953
}
954
954
}
955
955
956
- let read_sign_of_cmi sign name uid ~shape ~address :addr ~flags =
957
- let id = Ident. create_persistent (Compilation_unit.Name. to_string name) in
956
+ let read_sign_of_cmi { Persistent_env.Persistent_signature. cmi; _ } =
957
+ let name =
958
+ match cmi.cmi_kind with
959
+ | Normal { cmi_impl } -> cmi_impl
960
+ | Parameter -> Misc. fatal_error " Unsupported import of parameter module"
961
+ in
962
+ let sign = cmi.cmi_sign in
963
+ let flags = cmi.cmi_flags in
964
+ let id = Ident. create_persistent (Compilation_unit. name_as_string name) in
958
965
let path = Pident id in
959
966
let alerts =
960
967
List. fold_left (fun acc -> function Alerts s -> s | _ -> acc)
961
968
Misc.Stdlib.String.Map. empty
962
969
flags
963
970
in
971
+ let sign = Subst.Lazy. signature Make_local Subst. identity sign in
964
972
let md =
965
973
{ Subst.Lazy. md_type = Mty_signature sign;
966
974
md_loc = Location. none;
967
975
md_attributes = [] ;
968
- md_uid = uid ;
976
+ md_uid = Uid. of_compilation_unit_id name ;
969
977
}
970
978
in
971
- let mda_address = Lazy_backtrack. create_forced addr in
979
+ let mda_address = Lazy_backtrack. create_forced ( Aunit name) in
972
980
let mda_declaration = md in
973
- let mda_shape = shape in
981
+ let mda_shape =
982
+ Shape. for_persistent_unit (name |> Compilation_unit. full_path_as_string)
983
+ in
974
984
let mda_components =
975
985
let mty = md.md_type in
976
986
components_of_module ~alerts ~uid: md.md_uid
@@ -1006,7 +1016,7 @@ let check_pers_mod ~loc name =
1006
1016
Persistent_env. check ! persistent_env read_sign_of_cmi ~loc name
1007
1017
1008
1018
let crc_of_unit name =
1009
- Persistent_env. crc_of_unit ! persistent_env name
1019
+ Persistent_env. crc_of_unit ! persistent_env read_sign_of_cmi name
1010
1020
1011
1021
let is_imported_opaque modname =
1012
1022
Persistent_env. is_imported_opaque ! persistent_env modname
@@ -2636,8 +2646,13 @@ let open_signature
2636
2646
2637
2647
(* Read a signature from a file *)
2638
2648
let read_signature modname filename ~add_binding =
2639
- let mty = read_pers_mod modname filename ~add_binding in
2640
- Subst.Lazy. force_signature mty
2649
+ let mda =
2650
+ read_pers_mod modname filename ~add_binding
2651
+ in
2652
+ let md = Subst.Lazy. force_module_decl mda.mda_declaration in
2653
+ match md.md_type with
2654
+ | Mty_signature sg -> sg
2655
+ | Mty_ident _ | Mty_functor _ | Mty_alias _ | Mty_strengthen _ -> assert false
2641
2656
2642
2657
let is_identchar_latin1 = function
2643
2658
| 'A' ..'Z' | 'a' ..'z' | '_' | '\192' ..'\214' | '\216' ..'\246'
0 commit comments