Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/ocaml/typing/persistent_env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ let register_pers_for_short_paths penv modname ps components =
let crc = Import_info.crc import in
name, crc)
in
let deps, alias_deps =
let depends, alias_depends =
List.fold_left
(fun (deps, alias_deps) (name, digest) ->
let name_as_string = Compilation_unit.Name.to_string name in
Expand All @@ -356,10 +356,9 @@ let register_pers_for_short_paths penv modname ps components =
if is_deprecated then Short_paths.Desc.Deprecated
else Short_paths.Desc.Not_deprecated
in
(* CR parameterized modules: this will probably break with parameterized modules *)
let modname_as_string = Global_module.Name.to_string modname in
Short_paths.Basis.load (short_paths_basis penv) modname_as_string
deps alias_deps desc ps.ps_name_info.pn_import.imp_visibility deprecated
(* CR parameterized modules: [depends] and [alias_depends] are missing instantiation. *)
Short_paths.Basis.load (short_paths_basis penv) modname
~depends ~alias_depends desc ps.ps_name_info.pn_import.imp_visibility deprecated
(* Reading persistent structures from .cmi files *)

let save_import penv crc modname impl flags filename =
Expand Down
17 changes: 10 additions & 7 deletions src/ocaml/typing/short_paths.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ module String_set = Set.Make(String)
module Basis = struct

type load =
{ name : string;
{ name : Global_module.Name.t;
depends : string list;
alias_depends : string list;
desc : Desc.Module.t;
Expand Down Expand Up @@ -1775,7 +1775,8 @@ module Basis = struct
Rev_deps.extend_up_to t.rev_deps t.next_dep;
List.iter
(fun { name; depends; alias_depends; _ } ->
let index = String_map.find name t.assignment in
String_map.find_opt name.Global_module.Name.head t.assignment
|> Option.iter (fun index ->
List.iter
(fun dep_name ->
let dep_index = String_map.find dep_name t.assignment in
Expand All @@ -1785,29 +1786,31 @@ module Basis = struct
(fun dep_name ->
let dep_index = String_map.find dep_name t.assignment in
Rev_deps.add_alias t.rev_deps ~source:dep_index ~target:index)
alias_depends)
alias_depends))
loads

let update_shortest t additions loads =
let components =
List.map
List.filter_map
(fun { name; desc; visibility=load_visibility; deprecated; _ } ->
let index = String_map.find name t.assignment in
String_map.find_opt name.Global_module.Name.head t.assignment
|> Option.map (fun index ->
let origin = Origin.Dependency index in
let id = Ident.global name in
let component_visibility : Desc.visibility =
match load_visibility, deprecated with
| Hidden, _ | _, Deprecated -> Hidden
| Visible, Not_deprecated -> Visible
in
Component.Module(origin, id, desc, Component.Global, component_visibility))
Component.Module(origin, id, desc, Component.Global, component_visibility)))
loads
in
let components =
String_set.fold
(fun name acc ->
let index = String_map.find name t.assignment in
let origin = Origin.Dependency index in
let name = Global_module.Name.create_no_args name in
let id = Ident.global name in
Component.Declare_module(origin, id) :: acc)
additions
Expand Down Expand Up @@ -1844,7 +1847,7 @@ module Basis = struct
let add t name =
t.pending_additions <- String_set.add name t.pending_additions

let load t name depends alias_depends desc visibility deprecated =
let load t name ~depends ~alias_depends desc visibility deprecated =
let load = { name; depends; alias_depends; desc; visibility; deprecated } in
t.pending_loads <- load :: t.pending_loads

Expand Down
2 changes: 1 addition & 1 deletion src/ocaml/typing/short_paths.mli
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Basis : sig

val add : t -> string -> unit

val load : t -> string -> string list -> string list ->
val load : t -> Global_module.Name.t -> depends:string list -> alias_depends:string list ->
Desc.Module.t -> Load_path.visibility -> Desc.deprecated -> unit

end
Expand Down
2 changes: 1 addition & 1 deletion src/ocaml/typing/short_paths_graph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Ident = struct
let name = Ident.name

let global name =
Ident.create_persistent name
Ident.create_global name

end

Expand Down
2 changes: 1 addition & 1 deletion src/ocaml/typing/short_paths_graph.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Ident : sig

val name : t -> string

val global : string -> t
val global : Global_module.Name.t -> t

end

Expand Down