···20202121let rec show_type_name_verbose h : Path.Type.t -> _ = function
2222 | `Resolved t ->
2323- (match Path.Resolved.(identifier (t :> t)) with
2323+ let i = Path.Resolved.(identifier (t :> t)) in
2424+ (match i with
2425 | Some i -> Format.fprintf h "%a" show_ident_long i
2525- | None ->
2626- (match t with
2727- | `CoreType n -> Format.fprintf h "%s" (Odoc_model.Names.TypeName.to_string n)
2828- | _ -> Format.fprintf h "%s" "Core type"))
2626+ | None -> Format.fprintf h "<unresolved>")
2927 | `Identifier (path, _hidden) ->
3028 let name = String.concat "." @@ Identifier.fullname path in
3129 Format.fprintf h "%s" name
···3634 (Odoc_document.Url.render_path (mdl :> Path.t))
3735 (Odoc_model.Names.TypeName.to_string x)
3836 | `SubstitutedT x -> show_type_name_verbose h x
3737+ | `SubstitutedCT x -> show_type_name_verbose h (x :> Path.Type.t)
3838+ | `LocalTy (`Na _) -> .
3939+ | `Type (`Na _, _, _) -> .
39404041let to_string t = Format.asprintf "%a" show_type_name_verbose t
+14-10
odoc/src/document/generator.ml
···138138 let link1 = from_path (p1 :> Path.t) in
139139 let link2 = from_path (p2 :> Path.t) in
140140 link1 ++ O.txt "(" ++ link2 ++ O.txt ")"
141141+ | `Module (`Na _, _, _) -> .
142142+ | `ModuleType (`Na _, _, _) -> .
143143+ | `Type (`Na _, _, _) -> .
144144+ | `LocalMod (`Na _) -> .
145145+ | `LocalModTy (`Na _) -> .
146146+ | `LocalTy (`Na _) -> .
147147+ | `LocalVal (`Na _) -> .
141148 | `Resolved _ when Paths.Path.is_hidden path ->
142149 let txt = Url.render_path path in
143150 unresolved [ inline @@ Text txt ]
151151+ | `Resolved (`CoreType n) ->
152152+ O.elt [ inline @@ Text (TypeName.to_string n) ]
144153 | `Resolved rp -> (
145154 (* If the path is pointing to an opaque module or module type
146155 there won't be a page generated - so we stop before; at
···152161 | _ -> false
153162 in
154163 let txt = [ inline @@ Text (Url.render_path path) ] in
155155- match Paths.Path.Resolved.identifier rp with
156156- | Some id ->
157157- let href = Url.from_identifier ~stop_before id in
158158- resolved href txt
159159- | None -> O.elt txt)
164164+ let id = Option.get (Paths.Path.Resolved.identifier rp) in
165165+ let href = Url.from_identifier ~stop_before id in
166166+ resolved href txt)
160167161168 let dot prefix suffix = prefix ^ "." ^ suffix
162169···200207 let open Fragment in
201208 let id = Resolved.identifier (fragment :> Resolved.t) in
202209 let txt = render_resolved_fragment (fragment :> Resolved.t) in
203203- match id with
204204- | Some id ->
205205- let href = Url.from_identifier ~stop_before:false id in
206206- resolved href [ inline @@ Text txt ]
207207- | None -> unresolved [ inline @@ Text txt ]
210210+ let href = Url.from_identifier ~stop_before:false id in
211211+ resolved href [ inline @@ Text txt ]
208212209213 let from_fragment : Fragment.leaf -> text = function
210214 | `Resolved r
···219219 | None -> `Return
220220 in
221221 let rec extract_tail_alerts acc = function
222222- (* Accumulate the alerts after the top-comment. Stop at the next comment. *)
222222+ (* Accumulate the alerts after the top-comment. Stop at the next comment.
223223+ [`Skip] items (open statements, unrecognised attributes) are preserved
224224+ in the returned items list — dropping them silently loses [open
225225+ struct ... end] declarations that follow the top docstring. *)
223226 | hd :: tl as items -> (
224227 match classify hd with
225228 | `Text _ | `Return -> (items, acc)
226229 | `Alert alert -> extract_tail_alerts (alert :: acc) tl
227227- | `Skip -> extract_tail_alerts acc tl)
230230+ | `Skip ->
231231+ let items, alerts = extract_tail_alerts acc tl in
232232+ (hd :: items, alerts))
228233 | [] -> ([], acc)
229234 and extract = function
230235 (* Extract the first comment and accumulate the alerts before and after
+512-324
odoc/src/model/paths.ml
···19192020open Names
21212222+type na_ty = |
2323+type na = [ `Na of na_ty ]
2424+2225module Identifier = struct
2326 type 'a id = 'a Paths_types.id = { iv : 'a; ihash : int; ikey : string }
2427···666669 end
667670end
668671672672+module P = Paths_types.Path
673673+module RP = Paths_types.Resolved_path
674674+669675module Path = struct
670670- type t = Paths_types.Path.any
676676+ type ('lmod, 'lmodty, 'pty, 'a) genfn3 = {
677677+ lmod : 'lmod -> 'a;
678678+ lmodty : 'lmodty -> 'a;
679679+ pty : 'pty -> 'a;
680680+ }
671681672672- let rec is_resolved_hidden :
673673- weak_canonical_test:bool -> Paths_types.Resolved_path.any -> bool =
674674- fun ~weak_canonical_test x ->
675675- let open Paths_types.Resolved_path in
676676- let rec inner : Paths_types.Resolved_path.any -> bool = function
677677- | `Identifier { iv = `ModuleType (_, m); _ }
678678- when Names.ModuleTypeName.is_hidden m ->
679679- true
680680- | `Identifier { iv = `Type (_, t); _ } when Names.TypeName.is_hidden t ->
681681- true
682682- | `Identifier { iv = `Module (_, m); _ } when Names.ModuleName.is_hidden m
683683- ->
684684- true
682682+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval, 'a) genfn5 = {
683683+ g : ('lmod, 'lmodty, 'pty, 'a) genfn3;
684684+ lty : 'lty -> 'a;
685685+ lval : 'lval -> 'a;
686686+ }
687687+688688+ module Hidden = struct
689689+ let rec rgen :
690690+ wct:bool ->
691691+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
692692+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) RP.any ->
693693+ bool =
694694+ fun ~wct f x ->
695695+ match x with
696696+ | `Identifier { iv = `ModuleType (_, m); _ } -> ModuleTypeName.is_hidden m
697697+ | `Identifier { iv = `Type (_, t); _ } -> TypeName.is_hidden t
698698+ | `Identifier { iv = `Module (_, m); _ } -> ModuleName.is_hidden m
685699 | `Identifier _ -> false
686700 | `Canonical (_, `Resolved _) -> false
687687- | `Canonical (x, _) ->
688688- (not weak_canonical_test) && inner (x : module_ :> any)
701701+ | `Canonical (x, _) -> (not wct) && rmod ~wct f x
689702 | `Hidden _ -> true
690690- | `Subst (p1, p2) ->
691691- inner (p1 : module_type :> any) || inner (p2 : module_ :> any)
692692- | `Module (p, _) -> inner (p : module_ :> any)
693693- | `Apply (p, _) -> inner (p : module_ :> any)
694694- | `ModuleType (_, m) when Names.ModuleTypeName.is_hidden m -> true
695695- | `ModuleType (p, _) -> inner (p : module_ :> any)
696696- | `Type (_, t) when Names.TypeName.is_hidden t -> true
697697- | `CoreType t -> Names.TypeName.is_hidden t
698698- | `Type (p, _) -> inner (p : module_ :> any)
699699- | `Value (_, t) when Names.ValueName.is_hidden t -> true
700700- | `Value (p, _) -> inner (p : module_ :> any)
701701- | `Class (p, _) -> inner (p : module_ :> any)
702702- | `ClassType (p, _) -> inner (p : module_ :> any)
703703- | `Alias (dest, `Resolved src) ->
704704- inner (dest : module_ :> any) && inner (src : module_ :> any)
705705- | `Alias (dest, src) ->
706706- inner (dest : module_ :> any)
707707- && is_path_hidden (src :> Paths_types.Path.any)
708708- | `AliasModuleType (p1, p2) ->
709709- inner (p1 : module_type :> any) && inner (p2 : module_type :> any)
710710- | `SubstT (p1, p2) -> inner (p1 :> any) || inner (p2 :> any)
711711- | `Substituted m -> inner (m :> any)
712712- | `SubstitutedMT m -> inner (m :> any)
713713- | `SubstitutedT m -> inner (m :> any)
714714- | `SubstitutedCT m -> inner (m :> any)
703703+ | `Subst (p1, p2) -> rmodty ~wct f p1 || rmod ~wct f p2
704704+ | `Module (p, _) -> parent ~wct f p
705705+ | `Apply (p, _) -> rmod ~wct f p
706706+ | `ModuleType (_, m) when ModuleTypeName.is_hidden m -> true
707707+ | `ModuleType (p, _) -> parent ~wct f p
708708+ | `Type (_, t) when TypeName.is_hidden t -> true
709709+ | `Type (p, _) -> parent ~wct f p
710710+ | `CoreType _ -> false
711711+ | `Value (_, t) when ValueName.is_hidden t -> true
712712+ | `Value (p, _) -> parent ~wct f p
713713+ | `Class (p, _) -> parent ~wct f p
714714+ | `ClassType (p, _) -> parent ~wct f p
715715+ | `Alias (dest, `Resolved src, _) -> rmod ~wct f dest && rmod ~wct f src
716716+ | `Alias (dest, src, _) -> rmod ~wct f dest && mod_ f src
717717+ | `AliasModuleType (p1, p2) -> rmodty ~wct f p1 && rmodty ~wct f p2
718718+ | `SubstT (p1, p2) -> rmodty ~wct f p1 || rmodty ~wct f p2
719719+ | `Substituted m -> rmod ~wct f m
720720+ | `SubstitutedMT m -> rmodty ~wct f m
721721+ | `SubstitutedT m -> rty ~wct f m
722722+ | `SubstitutedCT m -> rcty ~wct f m
715723 | `CanonicalModuleType (_, `Resolved _) -> false
716716- | `CanonicalModuleType (x, _) -> inner (x : module_type :> any)
724724+ | `CanonicalModuleType (m, _) -> rmodty ~wct f m
717725 | `CanonicalType (_, `Resolved _) -> false
718718- | `CanonicalType (x, _) -> inner (x : type_ :> any)
719719- | `OpaqueModule m -> inner (m :> any)
720720- | `OpaqueModuleType mt -> inner (mt :> any)
721721- in
722722- inner x
726726+ | `CanonicalType (x, _) -> rty ~wct f x
727727+ | `OpaqueModule m -> rmod ~wct f m
728728+ | `OpaqueModuleType mt -> rmodty ~wct f mt
729729+ | `LocalMod m -> f.g.lmod m
730730+ | `LocalModTy mt -> f.g.lmodty mt
731731+ | `LocalTy ty -> f.lty ty
732732+ | `LocalVal v -> f.lval v
733733+734734+ and[@ocaml.inline always] parent :
735735+ wct:bool ->
736736+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
737737+ ('lmod, 'lmodty, 'pty) RP.parent ->
738738+ bool =
739739+ fun ~wct f parent ->
740740+ match parent with
741741+ | `Module m -> rmod ~wct f m
742742+ | `ModuleType (mty, _) -> rmodty ~wct f mty
743743+ | `FragmentRoot fr -> f.g.pty fr
744744+745745+ and gen :
746746+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
747747+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) P.any ->
748748+ bool =
749749+ fun f p ->
750750+ match p with
751751+ | `Resolved r -> rgen ~wct:false f r
752752+ | `Identifier (_, hidden) -> hidden
753753+ | `Substituted r -> mod_ f r
754754+ | `SubstitutedMT r -> modty f r
755755+ | `SubstitutedT r -> ty f r
756756+ | `SubstitutedCT r -> cty f r
757757+ | `Root s -> ModuleName.is_hidden s
758758+ | `Forward _ -> false
759759+ | `Dot (p, n) -> ModuleName.is_hidden n || mod_ f p
760760+ | `DotMT (p, n) -> ModuleTypeName.is_hidden n || mod_ f p
761761+ | `DotT (p, n) -> TypeName.is_hidden n || mod_ f p
762762+ | `DotV (p, n) -> ValueName.is_hidden n || mod_ f p
763763+ | `Apply (p1, p2) -> mod_ f p1 || mod_ f p2
764764+ | `Module (_, p, n) -> ModuleName.is_hidden n || parent ~wct:false f p
765765+ | `ModuleType (_, p, n) ->
766766+ ModuleTypeName.is_hidden n || parent ~wct:false f p
767767+ | `Type (_, p, n) -> TypeName.is_hidden n || parent ~wct:false f p
768768+ | `LocalMod m -> f.g.lmod m
769769+ | `LocalModTy mty -> f.g.lmodty mty
770770+ | `LocalTy ty -> f.lty ty
771771+ | `LocalVal v -> f.lval v
772772+773773+ (* Coercion functions, always inlined! *)
774774+775775+ and[@ocaml.inline always] mod_ f m =
776776+ gen f
777777+ (m
778778+ : ('lmod, 'lmodty, 'pty) P.module_
779779+ :> ('lmod, 'lmodty, 'pty, _, _) P.any)
780780+781781+ and[@ocaml.inline always] modty f m =
782782+ gen f
783783+ (m
784784+ : ('lmod, 'lmodty, 'pty) P.module_type
785785+ :> ('lmod, 'lmodty, 'pty, _, _) P.any)
786786+787787+ and[@ocaml.inline always] ty f t =
788788+ gen f
789789+ (t
790790+ : ('lmod, 'lmodty, 'pty, 'lty) P.type_
791791+ :> ('lmod, 'lmodty, 'pty, 'lty, _) P.any)
792792+793793+ and[@ocaml.inline always] cty f t =
794794+ gen f
795795+ (t
796796+ : ('lmod, 'lmodty, 'pty, 'lty) P.class_type
797797+ :> ('lmod, 'lmodty, 'pty, 'lty, _) P.any)
798798+799799+ and[@ocaml.inline always] rmod ~wct f
800800+ (m : ('lmod, 'lmodty, 'pty) RP.module_) =
801801+ rgen ~wct f (m :> ('lmod, 'lmodty, 'pty, _, _) RP.any)
802802+803803+ and[@ocaml.inline always] rmodty ~wct f
804804+ (m : ('lmod, 'lmodty, 'pty) RP.module_type) =
805805+ rgen ~wct f (m :> ('lmod, 'lmodty, 'pty, _, _) RP.any)
806806+807807+ and[@ocaml.inline always] rty ~wct f
808808+ (t : ('lmod, 'lmodty, 'pty, 'lty) RP.type_) =
809809+ rgen ~wct f (t :> ('lmod, 'lmodty, 'pty, 'lty, _) RP.any)
810810+811811+ and[@ocaml.inline always] rcty ~wct f
812812+ (t : ('lmod, 'lmodty, 'pty, 'lty) RP.class_type) =
813813+ rgen ~wct f (t :> ('lmod, 'lmodty, 'pty, 'lty, _) RP.any)
814814+ end
815815+816816+ let is_resolved_hidden_gen :
817817+ weak_canonical_test:bool ->
818818+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
819819+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) RP.any ->
820820+ bool =
821821+ fun ~weak_canonical_test:wct f p -> Hidden.rgen ~wct f p
822822+823823+ let is_hidden_gen :
824824+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
825825+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) P.any ->
826826+ bool =
827827+ fun f p -> Hidden.gen f p
828828+829829+ type ('a, 'b, 'c, 'd, 'e) gen = ('a, 'b, 'c, 'd, 'e) P.any
830830+ type t = (na, na, na, na, na) P.any
831831+ type rt = (na, na, na, na, na) RP.any
832832+ type parent = (na, na, na) RP.parent
833833+834834+ type rmodule = (na, na, na) RP.module_
835835+836836+ let get_parent_module : parent -> rmodule = function
837837+ | `Module p -> p
838838+ | `ModuleType (_, `Na _) | `FragmentRoot (`Na _) -> .
839839+840840+ let f =
841841+ {
842842+ g =
843843+ {
844844+ lmod = (fun _ -> false);
845845+ lmodty = (fun _ -> false);
846846+ pty = (fun _ -> false);
847847+ };
848848+ lty = (fun _ -> false);
849849+ lval = (fun _ -> false);
850850+ }
723851724724- and is_path_hidden : Paths_types.Path.any -> bool =
725725- let open Paths_types.Path in
726726- function
727727- | `Resolved r -> is_resolved_hidden ~weak_canonical_test:false r
728728- | `Identifier (_, hidden) -> hidden
729729- | `Substituted r -> is_path_hidden (r :> any)
730730- | `SubstitutedMT r -> is_path_hidden (r :> any)
731731- | `SubstitutedT r -> is_path_hidden (r :> any)
732732- | `SubstitutedCT r -> is_path_hidden (r :> any)
733733- | `Root s -> ModuleName.is_hidden s
734734- | `Forward _ -> false
735735- | `Dot (p, n) ->
736736- ModuleName.is_hidden n || is_path_hidden (p : module_ :> any)
737737- | `DotMT (p, n) ->
738738- ModuleTypeName.is_hidden n || is_path_hidden (p : module_ :> any)
739739- | `DotT (p, n) ->
740740- TypeName.is_hidden n || is_path_hidden (p : module_ :> any)
741741- | `DotV (p, n) ->
742742- ValueName.is_hidden n || is_path_hidden (p : module_ :> any)
743743- | `Apply (p1, p2) ->
744744- is_path_hidden (p1 : module_ :> any)
745745- || is_path_hidden (p2 : module_ :> any)
852852+ let is_resolved_hidden ~weak_canonical_test p =
853853+ is_resolved_hidden_gen ~weak_canonical_test f p
854854+855855+ let is_path_hidden p = is_hidden_gen f p
746856747857 module Resolved = struct
748748- type t = Paths_types.Resolved_path.any
858858+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval) gen =
859859+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) RP.any
860860+ type t = (na, na, na, na, na) gen
861861+ type nonrec parent = parent
862862+ type nonrec ('a, 'b, 'c) parent_gen = ('a, 'b, 'c) RP.parent
749863750864 let rec parent_module_type_identifier :
751751- Paths_types.Resolved_path.module_type -> Identifier.ModuleType.t option
752752- = function
753753- | `Identifier id -> Some (id : Identifier.ModuleType.t)
754754- | `ModuleType (m, n) -> (
755755- match parent_module_identifier m with
756756- | None -> None
757757- | Some p -> Some (Identifier.Mk.module_type (p, n)))
865865+ (na, na, na) RP.module_type -> Identifier.Signature.t = function
866866+ | `Identifier id ->
867867+ (id : Identifier.ModuleType.t :> Identifier.Signature.t)
868868+ | `ModuleType (p, n) ->
869869+ let m = get_parent_module p in
870870+ Identifier.Mk.module_type (parent_module_identifier m, n)
758871 | `SubstT (m, _n) -> parent_module_type_identifier m
759872 | `CanonicalModuleType (_, `Resolved p) -> parent_module_type_identifier p
760873 | `CanonicalModuleType (p, _) -> parent_module_type_identifier p
···764877 if is_resolved_hidden ~weak_canonical_test:false (sub :> t) then
765878 parent_module_type_identifier orig
766879 else parent_module_type_identifier sub
880880+ | `LocalModTy (`Na _) -> .
767881768882 and parent_module_identifier :
769769- Paths_types.Resolved_path.module_ -> Identifier.Signature.t option =
770770- function
883883+ (na, na, na) RP.module_ -> Identifier.Signature.t = function
771884 | `Identifier id ->
772772- Some (id : Identifier.Path.Module.t :> Identifier.Signature.t)
773773- | `Subst (sub, _) ->
774774- (parent_module_type_identifier sub :> Identifier.Signature.t option)
775775- | `Hidden _ -> None
776776- | `Module (m, n) -> (
777777- match parent_module_identifier m with
778778- | None -> None
779779- | Some p -> Some (Identifier.Mk.module_ (p, n)))
885885+ (id : Identifier.Path.Module.t :> Identifier.Signature.t)
886886+ | `Subst (sub, _) -> parent_module_type_identifier sub
887887+ | `Hidden p -> parent_module_identifier p
888888+ | `Module (p, n) ->
889889+ let m = get_parent_module p in
890890+ Identifier.Mk.module_ (parent_module_identifier m, n)
780891 | `Canonical (_, `Resolved p) -> parent_module_identifier p
781892 | `Canonical (p, _) -> parent_module_identifier p
782893 | `Apply (m, _) -> parent_module_identifier m
783783- | `Alias (dest, `Resolved src) ->
894894+ | `Alias (dest, `Resolved src, _) ->
784895 if is_resolved_hidden ~weak_canonical_test:false (dest :> t) then
785896 parent_module_identifier src
786897 else parent_module_identifier dest
787787- | `Alias (dest, _src) -> parent_module_identifier dest
898898+ | `Alias (dest, _src, _) -> parent_module_identifier dest
788899 | `Substituted m -> parent_module_identifier m
789900 | `OpaqueModule m -> parent_module_identifier m
901901+ | `LocalMod (`Na _) -> .
790902791903 module Module = struct
792792- type t = Paths_types.Resolved_path.module_
904904+ type ('lmod, 'lmodty, 'pty) gen = ('lmod, 'lmodty, 'pty) RP.module_
905905+ type t = (na, na, na) gen
793906794794- let is_hidden m =
795795- is_resolved_hidden (m : t :> Paths_types.Resolved_path.any)
907907+ let is_hidden m = is_resolved_hidden (m : t :> rt)
796908 end
797909798910 module ModuleType = struct
799799- type t = Paths_types.Resolved_path.module_type
800800-801801- let identifier : t -> Identifier.ModuleType.t option =
802802- parent_module_type_identifier
911911+ type ('lmod, 'lmodty, 'pty) gen = ('lmod, 'lmodty, 'pty) RP.module_type
912912+ type t = (na, na, na) gen
803913 end
804914805915 module Type = struct
806806- type t = Paths_types.Resolved_path.type_
916916+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
917917+ ('lmod, 'lmodty, 'pty, 'lty) RP.type_
918918+ type t = (na, na, na, na) gen
807919 end
808920809921 module Value = struct
810810- type t = Paths_types.Resolved_path.value
922922+ type ('lmod, 'lmodty, 'pty, 'lval) gen =
923923+ ('lmod, 'lmodty, 'pty, 'lval) RP.value
924924+ type t = (na, na, na, na) gen
811925 end
812926813927 module ClassType = struct
814814- type t = Paths_types.Resolved_path.class_type
928928+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
929929+ ('lmod, 'lmodty, 'pty, 'lty) RP.class_type
930930+ type t = (na, na, na, na) gen
815931 end
816932817817- let rec identifier : t -> Identifier.t option =
818818- let parent p f =
819819- match parent_module_identifier p with
820820- | None -> None
821821- | Some id -> Some (f id :> Identifier.t)
822822- in
823823- function
933933+ let rec identifier : rt -> Identifier.t option = function
824934 | `Identifier id -> Some id
935935+ | `Subst (sub, _) -> identifier (sub :> rt)
936936+ | `Hidden p -> identifier (p :> rt)
937937+ | `Module (p, n) ->
938938+ let m = get_parent_module p in
939939+ Some (Identifier.Mk.module_ (parent_module_identifier m, n))
940940+ | `Canonical (_, `Resolved p) -> identifier (p :> rt)
941941+ | `Canonical (p, _) -> identifier (p :> rt)
942942+ | `Apply (m, _) -> identifier (m :> rt)
943943+ | `Type (p, n) ->
944944+ let m = get_parent_module p in
945945+ Some (Identifier.Mk.type_ (parent_module_identifier m, n))
946946+ | `Value (p, n) ->
947947+ let m = get_parent_module p in
948948+ Some (Identifier.Mk.value (parent_module_identifier m, n))
949949+ | `ModuleType (p, n) ->
950950+ let m = get_parent_module p in
951951+ Some (Identifier.Mk.module_type (parent_module_identifier m, n))
952952+ | `Class (p, n) ->
953953+ let m = get_parent_module p in
954954+ Some (Identifier.Mk.class_ (parent_module_identifier m, n))
955955+ | `ClassType (p, n) ->
956956+ let m = get_parent_module p in
957957+ Some (Identifier.Mk.class_type (parent_module_identifier m, n))
958958+ | `Alias (dest, `Resolved src, _) ->
959959+ if is_resolved_hidden ~weak_canonical_test:false (dest :> rt) then
960960+ identifier (src :> rt)
961961+ else identifier (dest :> rt)
962962+ | `Alias (dest, _src, _) -> identifier (dest :> rt)
963963+ | `AliasModuleType (sub, orig) ->
964964+ if is_resolved_hidden ~weak_canonical_test:false (sub :> rt) then
965965+ identifier (orig :> rt)
966966+ else identifier (sub :> rt)
967967+ | `SubstT (p, _) -> identifier (p :> rt)
968968+ | `CanonicalModuleType (_, `Resolved p) -> identifier (p :> rt)
969969+ | `CanonicalModuleType (p, _) -> identifier (p :> rt)
970970+ | `CanonicalType (_, `Resolved p) -> identifier (p :> rt)
971971+ | `CanonicalType (p, _) -> identifier (p :> rt)
972972+ | `OpaqueModule m -> identifier (m :> rt)
973973+ | `OpaqueModuleType mt -> identifier (mt :> rt)
974974+ | `Substituted m -> identifier (m :> rt)
975975+ | `SubstitutedMT m -> identifier (m :> rt)
976976+ | `SubstitutedCT m -> identifier (m :> rt)
977977+ | `SubstitutedT m -> identifier (m :> rt)
825978 | `CoreType _ -> None
826826- | `Subst (sub, _) -> identifier (sub :> t)
827827- | `Hidden _p -> None
828828- | `Module (m, n) -> parent m (fun p -> Identifier.Mk.module_ (p, n))
829829- | `Canonical (_, `Resolved p) -> identifier (p :> t)
830830- | `Canonical (p, _) -> identifier (p :> t)
831831- | `Apply (m, _) -> identifier (m :> t)
832832- | `Type (m, n) -> parent m (fun p -> Identifier.Mk.type_ (p, n))
833833- | `Value (m, n) -> parent m (fun p -> Identifier.Mk.value (p, n))
834834- | `ModuleType (m, n) ->
835835- parent m (fun p -> Identifier.Mk.module_type (p, n))
836836- | `Class (m, n) -> parent m (fun p -> Identifier.Mk.class_ (p, n))
837837- | `ClassType (m, n) -> parent m (fun p -> Identifier.Mk.class_type (p, n))
838838- | `Alias (dest, `Resolved src) ->
839839- if is_resolved_hidden ~weak_canonical_test:false (dest :> t) then
840840- identifier (src :> t)
841841- else identifier (dest :> t)
842842- | `Alias (dest, _src) -> identifier (dest :> t)
843843- | `AliasModuleType (sub, orig) ->
844844- if is_resolved_hidden ~weak_canonical_test:false (sub :> t) then
845845- identifier (orig :> t)
846846- else identifier (sub :> t)
847847- | `SubstT (p, _) -> identifier (p :> t)
848848- | `CanonicalModuleType (_, `Resolved p) -> identifier (p :> t)
849849- | `CanonicalModuleType (p, _) -> identifier (p :> t)
850850- | `CanonicalType (_, `Resolved p) -> identifier (p :> t)
851851- | `CanonicalType (p, _) -> identifier (p :> t)
852852- | `OpaqueModule m -> identifier (m :> t)
853853- | `OpaqueModuleType mt -> identifier (mt :> t)
854854- | `Substituted m -> identifier (m :> t)
855855- | `SubstitutedMT m -> identifier (m :> t)
856856- | `SubstitutedCT m -> identifier (m :> t)
857857- | `SubstitutedT m -> identifier (m :> t)
979979+ | `LocalMod (`Na _) -> .
980980+ | `LocalModTy (`Na _) -> .
981981+ | `LocalTy (`Na _) -> .
982982+ | `LocalVal (`Na _) -> .
858983859984 let is_hidden r = is_resolved_hidden ~weak_canonical_test:false r
860985 end
861986862987 module Module = struct
863863- type t = Paths_types.Path.module_
988988+ type ('lmod, 'lmodty, 'pty) gen = ('lmod, 'lmodty, 'pty) P.module_
989989+ type t = (na, na, na) gen
864990 end
865991866992 module ModuleType = struct
867867- type t = Paths_types.Path.module_type
993993+ type ('lmod, 'lmodty, 'pty) gen = ('lmod, 'lmodty, 'pty) P.module_type
994994+ type t = (na, na, na) gen
868995 end
869996870997 module Type = struct
871871- type t = Paths_types.Path.type_
998998+ type ('lmod, 'lmodty, 'pty, 'lty) gen = ('lmod, 'lmodty, 'pty, 'lty) P.type_
999999+ type t = (na, na, na, na) gen
8721000 end
87310018741002 module Value = struct
875875- type t = Paths_types.Path.value
10031003+ type ('lmod, 'lmodty, 'pty, 'lval) gen =
10041004+ ('lmod, 'lmodty, 'pty, 'lval) P.value
10051005+ type t = (na, na, na, na) gen
8761006 end
87710078781008 module ClassType = struct
879879- type t = Paths_types.Path.class_type
10091009+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
10101010+ ('lmod, 'lmodty, 'pty, 'lty) P.class_type
10111011+ type t = (na, na, na, na) gen
8801012 end
88110138821014 let is_hidden = is_path_hidden
···88410168851017module Fragment = struct
8861018 module Resolved = struct
887887- type t = Paths_types.Resolved_fragment.any
10191019+ type ('lmod, 'lmodty, 'pty) gen =
10201020+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.any
10211021+ type t = (na, na, na) gen
8881022889889- type root = Paths_types.Resolved_fragment.root
890890-10231023+ type ('lmod, 'lmodty, 'pty) root_gen =
10241024+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.root
10251025+ type root = (na, na, na) root_gen
8911026 module Signature = struct
892892- type t = Paths_types.Resolved_fragment.signature
893893-894894- let rec sgidentifier : t -> Identifier.Signature.t option = function
895895- | `Root (`ModuleType i) ->
896896- (Path.Resolved.parent_module_type_identifier i
897897- :> Identifier.Signature.t option)
10271027+ type ('lmod, 'lmodty, 'pty) gen =
10281028+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.signature
10291029+ type t = (na, na, na) gen
10301030+ let rec sgidentifier : t -> Identifier.Signature.t = function
10311031+ | `Root (`ModuleType i) -> Path.Resolved.parent_module_type_identifier i
8981032 | `Root (`Module i) -> Path.Resolved.parent_module_identifier i
899899- | `Subst (s, _) ->
900900- (Path.Resolved.parent_module_type_identifier s
901901- :> Identifier.Signature.t option)
10331033+ | `Subst (s, _) -> Path.Resolved.parent_module_type_identifier s
9021034 | `Alias (i, _) -> Path.Resolved.parent_module_identifier i
903903- | `Module (m, n) -> (
904904- match sgidentifier m with
905905- | None -> None
906906- | Some p -> Some (Identifier.Mk.module_ (p, n)))
10351035+ | `Module (m, n) -> Identifier.Mk.module_ (sgidentifier m, n)
9071036 | `OpaqueModule m -> sgidentifier (m :> t)
9081037 end
90910389101039 module Module = struct
911911- type t = Paths_types.Resolved_fragment.module_
10401040+ type ('lmod, 'lmodty, 'pty) gen =
10411041+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.module_
10421042+ type t = (na, na, na) gen
9121043 end
91310449141045 module ModuleType = struct
915915- type t = Paths_types.Resolved_fragment.module_type
10461046+ type ('lmod, 'lmodty, 'pty) gen =
10471047+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.module_type
10481048+ type t = (na, na, na) gen
9161049 end
91710509181051 module Type = struct
919919- type t = Paths_types.Resolved_fragment.type_
10521052+ type ('lmod, 'lmodty, 'pty) gen =
10531053+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.type_
10541054+ type t = (na, na, na) gen
9201055 end
9211056922922- type leaf = Paths_types.Resolved_fragment.leaf
10571057+ type ('lmod, 'lmodty, 'pty) leaf_gen =
10581058+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.leaf
10591059+ type leaf = (na, na, na) leaf_gen
9231060924924- let rec identifier : t -> Identifier.t option = function
10611061+ let rec identifier : t -> Identifier.t = function
9251062 | `Root (`ModuleType _r) -> assert false
9261063 | `Root (`Module _r) -> assert false
927927- | `Subst (s, _) ->
928928- (Path.Resolved.ModuleType.identifier s :> Identifier.t option)
10641064+ | `Subst (s, _) -> Option.get (Path.Resolved.identifier (s :> Path.Resolved.t))
9291065 | `Alias (p, _) ->
930930- (Path.Resolved.parent_module_identifier p :> Identifier.t option)
931931- | `Module (m, n) -> (
932932- match Signature.sgidentifier m with
933933- | None -> None
934934- | Some p -> Some (Identifier.Mk.module_ (p, n)))
935935- | `Module_type (m, n) -> (
936936- match Signature.sgidentifier m with
937937- | None -> None
938938- | Some p -> Some (Identifier.Mk.module_type (p, n)))
939939- | `Type (m, n) -> (
940940- match Signature.sgidentifier m with
941941- | None -> None
942942- | Some p -> Some (Identifier.Mk.type_ (p, n)))
943943- | `Class (m, n) -> (
944944- match Signature.sgidentifier m with
945945- | None -> None
946946- | Some p -> Some (Identifier.Mk.class_ (p, n)))
947947- | `ClassType (m, n) -> (
948948- match Signature.sgidentifier m with
949949- | None -> None
950950- | Some p -> Some (Identifier.Mk.class_type (p, n)))
10661066+ (Path.Resolved.parent_module_identifier p :> Identifier.t)
10671067+ | `Module (m, n) -> Identifier.Mk.module_ (Signature.sgidentifier m, n)
10681068+ | `Module_type (m, n) ->
10691069+ Identifier.Mk.module_type (Signature.sgidentifier m, n)
10701070+ | `Type (m, n) -> Identifier.Mk.type_ (Signature.sgidentifier m, n)
10711071+ | `Class (m, n) -> Identifier.Mk.class_ (Signature.sgidentifier m, n)
10721072+ | `ClassType (m, n) ->
10731073+ Identifier.Mk.class_type (Signature.sgidentifier m, n)
9511074 | `OpaqueModule m -> identifier (m :> t)
95210759531076 let rec is_hidden : t -> bool = function
···9641087 | `OpaqueModule m -> is_hidden (m :> t)
9651088 end
9661089967967- type t = Paths_types.Fragment.any
10901090+ type ('lmod, 'lmodty, 'pty) gen =
10911091+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.any
10921092+ type t = (na, na, na) gen
96810939691094 module Signature = struct
970970- type t = Paths_types.Fragment.signature
10951095+ type ('lmod, 'lmodty, 'pty) gen =
10961096+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.signature
10971097+ type t = (na, na, na) gen
9711098 end
97210999731100 module Module = struct
974974- type t = Paths_types.Fragment.module_
11011101+ type ('lmod, 'lmodty, 'pty) gen =
11021102+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.module_
11031103+ type t = (na, na, na) gen
9751104 end
97611059771106 module ModuleType = struct
978978- type t = Paths_types.Fragment.module_type
11071107+ type ('lmod, 'lmodty, 'pty) gen =
11081108+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.module_type
11091109+ type t = (na, na, na) gen
9791110 end
98011119811112 module Type = struct
982982- type t = Paths_types.Fragment.type_
11131113+ type ('lmod, 'lmodty, 'pty) gen =
11141114+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.type_
11151115+ type t = (na, na, na) gen
9831116 end
9841117985985- type leaf = Paths_types.Fragment.leaf
11181118+ type ('lmod, 'lmodty, 'pty) leaf_gen =
11191119+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.leaf
11201120+ type leaf = (na, na, na) leaf_gen
9861121end
98711229881123module Reference = struct
9891124 module Resolved = struct
9901125 open Paths_types.Resolved_reference
9911126992992- type t = Paths_types.Resolved_reference.any
11271127+ type ('lmod, 'lmodty, 'pty) gen =
11281128+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.any
11291129+ type t = (na, na, na) gen
99311309941131 let rec parent_signature_identifier :
995995- signature -> Identifier.Signature.t option = function
996996- | `Identifier id -> Some id
997997- | `Hidden _s -> None
11321132+ (na, na, na) signature -> Identifier.Signature.t = function
11331133+ | `Identifier id -> id
11341134+ | `Hidden s -> parent_signature_identifier (s :> (na, na, na) signature)
9981135 | `Alias (sub, orig) ->
9991136 if Path.Resolved.(is_hidden (sub :> t)) then
10001000- parent_signature_identifier (orig :> signature)
11371137+ parent_signature_identifier (orig :> (na, na, na) signature)
10011138 else
10021139 (Path.Resolved.parent_module_identifier sub
10031003- :> Identifier.Signature.t option)
11401140+ :> Identifier.Signature.t)
10041141 | `AliasModuleType (sub, orig) ->
10051142 if Path.Resolved.(is_hidden (sub :> t)) then
10061006- parent_signature_identifier (orig :> signature)
11431143+ parent_signature_identifier (orig :> (na, na, na) signature)
10071144 else
10081145 (Path.Resolved.parent_module_type_identifier sub
10091009- :> Identifier.Signature.t option)
10101010- | `Module (m, n) -> (
10111011- match parent_signature_identifier m with
10121012- | None -> None
10131013- | Some p -> Some (Identifier.Mk.module_ (p, n)))
10141014- | `ModuleType (m, n) -> (
10151015- match parent_signature_identifier m with
10161016- | None -> None
10171017- | Some p -> Some (Identifier.Mk.module_type (p, n)))
11461146+ :> Identifier.Signature.t)
11471147+ | `Module (m, n) ->
11481148+ Identifier.Mk.module_ (parent_signature_identifier m, n)
11491149+ | `ModuleType (m, s) ->
11501150+ Identifier.Mk.module_type (parent_signature_identifier m, s)
1018115110191019- and parent_type_identifier : datatype -> Identifier.DataType.t option =
10201020- function
10211021- | `Identifier id -> Some id
10221022- | `Type (sg, s) -> (
10231023- match parent_signature_identifier sg with
10241024- | None -> None
10251025- | Some p -> Some (Identifier.Mk.type_ (p, s)))
11521152+ and parent_type_identifier : (na, na, na) datatype -> Identifier.DataType.t
11531153+ = function
11541154+ | `Identifier id -> id
11551155+ | `Type (sg, s) -> Identifier.Mk.type_ (parent_signature_identifier sg, s)
1026115610271157 and parent_class_signature_identifier :
10281028- class_signature -> Identifier.ClassSignature.t option = function
10291029- | `Identifier id -> Some id
10301030- | `Class (sg, s) -> (
10311031- match parent_signature_identifier sg with
10321032- | None -> None
10331033- | Some p -> Some (Identifier.Mk.class_ (p, s)))
10341034- | `ClassType (sg, s) -> (
10351035- match parent_signature_identifier sg with
10361036- | None -> None
10371037- | Some p -> Some (Identifier.Mk.class_type (p, s)))
11581158+ (na, na, na) class_signature -> Identifier.ClassSignature.t = function
11591159+ | `Identifier id -> id
11601160+ | `Class (sg, s) ->
11611161+ Identifier.Mk.class_ (parent_signature_identifier sg, s)
11621162+ | `ClassType (sg, s) ->
11631163+ Identifier.Mk.class_type (parent_signature_identifier sg, s)
1038116410391165 and field_parent_identifier :
10401040- field_parent -> Identifier.FieldParent.t option = function
10411041- | `Identifier id -> Some id
11661166+ (na, na, na) field_parent -> Identifier.FieldParent.t = function
11671167+ | `Identifier id -> id
10421168 | (`Hidden _ | `Alias _ | `AliasModuleType _ | `Module _ | `ModuleType _)
10431169 as sg ->
10441044- (parent_signature_identifier sg :> Identifier.FieldParent.t option)
10451045- | `Type _ as t ->
10461046- (parent_type_identifier t :> Identifier.FieldParent.t option)
11701170+ (parent_signature_identifier sg :> Identifier.FieldParent.t)
11711171+ | `Type _ as t -> (parent_type_identifier t :> Identifier.FieldParent.t)
1047117210481048- and unboxed_field_parent_identifier : unboxed_field_parent -> Identifier.UnboxedFieldParent.t option =
11731173+ and unboxed_field_parent_identifier : (na, na, na) unboxed_field_parent -> Identifier.UnboxedFieldParent.t option =
10491174 function
10501175 | `Identifier id -> Some id
10511051- | `Type _ as t -> (parent_type_identifier t :> Identifier.UnboxedFieldParent.t option)
11761176+ | `Type _ as t -> Some (parent_type_identifier t :> Identifier.UnboxedFieldParent.t)
1052117710531178 and label_parent_identifier :
10541054- label_parent -> Identifier.LabelParent.t option = function
10551055- | `Identifier id -> Some id
11791179+ (na, na, na) label_parent -> Identifier.LabelParent.t = function
11801180+ | `Identifier id -> id
10561181 | (`Class _ | `ClassType _) as c ->
10571057- (parent_class_signature_identifier c
10581058- :> Identifier.LabelParent.t option)
11821182+ (parent_class_signature_identifier c :> Identifier.LabelParent.t)
10591183 | ( `Hidden _ | `Alias _ | `AliasModuleType _ | `Module _ | `ModuleType _
10601184 | `Type _ ) as r ->
10611061- (field_parent_identifier r :> Identifier.LabelParent.t option)
11851185+ (field_parent_identifier r :> Identifier.LabelParent.t)
1062118610631187 and identifier : t -> Identifier.t option = function
10641188 | `Identifier id -> Some id
···10681192 | Some p -> Some (Identifier.Mk.unboxed_field (p, n)))
10691193 | ( `Alias _ | `AliasModuleType _ | `Module _ | `Hidden _ | `Type _
10701194 | `Class _ | `ClassType _ | `ModuleType _ ) as r ->
10711071- (label_parent_identifier r :> Identifier.t option)
10721072- | `Field (p, n) -> (
10731073- match field_parent_identifier p with
10741074- | None -> None
10751075- | Some p -> Some (Identifier.Mk.field (p, n)))
10761076- | `PolyConstructor (s, n) -> (
10771077- (* Uses an identifier for constructor even though it is not
10781078- one. Document must make the links correspond. *)
10791079- match parent_type_identifier s with
10801080- | None -> None
10811081- | Some p -> Some (Identifier.Mk.constructor (p, n)))
10821082- | `Constructor (s, n) -> (
10831083- match parent_type_identifier s with
10841084- | None -> None
10851085- | Some p -> Some (Identifier.Mk.constructor (p, n)))
10861086- | `Extension (p, q) -> (
10871087- match parent_signature_identifier p with
10881088- | None -> None
10891089- | Some p -> Some (Identifier.Mk.extension (p, q)))
10901090- | `ExtensionDecl (p, q, r) -> (
10911091- match parent_signature_identifier p with
10921092- | None -> None
10931093- | Some p -> Some (Identifier.Mk.extension_decl (p, (q, r))))
10941094- | `Exception (p, q) -> (
10951095- match parent_signature_identifier p with
10961096- | None -> None
10971097- | Some p -> Some (Identifier.Mk.exception_ (p, q)))
10981098- | `Value (p, q) -> (
10991099- match parent_signature_identifier p with
11001100- | None -> None
11011101- | Some p -> Some (Identifier.Mk.value (p, q)))
11021102- | `Method (p, q) -> (
11031103- match parent_class_signature_identifier p with
11041104- | None -> None
11051105- | Some p -> Some (Identifier.Mk.method_ (p, q)))
11061106- | `InstanceVariable (p, q) -> (
11071107- match parent_class_signature_identifier p with
11081108- | None -> None
11091109- | Some p -> Some (Identifier.Mk.instance_variable (p, q)))
11101110- | `Label (p, q) -> (
11111111- match label_parent_identifier p with
11121112- | None -> None
11131113- | Some p -> Some (Identifier.Mk.label (p, q)))
11951195+ Some (label_parent_identifier r :> Identifier.t)
11961196+ | `Field (p, n) -> Some (Identifier.Mk.field (field_parent_identifier p, n))
11971197+ | `PolyConstructor (s, n) ->
11981198+ Some (Identifier.Mk.constructor
11991199+ ((parent_type_identifier s :> Identifier.DataType.t), n))
12001200+ | `Constructor (s, n) ->
12011201+ Some (Identifier.Mk.constructor
12021202+ ((parent_type_identifier s :> Identifier.DataType.t), n))
12031203+ | `Extension (p, q) ->
12041204+ Some (Identifier.Mk.extension (parent_signature_identifier p, q))
12051205+ | `ExtensionDecl (p, q, r) ->
12061206+ Some (Identifier.Mk.extension_decl (parent_signature_identifier p, (q, r)))
12071207+ | `Exception (p, q) ->
12081208+ Some (Identifier.Mk.exception_ (parent_signature_identifier p, q))
12091209+ | `Value (p, q) -> Some (Identifier.Mk.value (parent_signature_identifier p, q))
12101210+ | `Method (p, q) ->
12111211+ Some (Identifier.Mk.method_ (parent_class_signature_identifier p, q))
12121212+ | `InstanceVariable (p, q) ->
12131213+ Some (Identifier.Mk.instance_variable
12141214+ (parent_class_signature_identifier p, q))
12151215+ | `Label (p, q) -> Some (Identifier.Mk.label (label_parent_identifier p, q))
1114121611151217 module Signature = struct
11161116- type t = Paths_types.Resolved_reference.signature
12181218+ type ('lmod, 'lmodty, 'pty) gen =
12191219+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.signature
12201220+ type t = (na, na, na) gen
11171221 end
1118122211191223 module ClassSignature = struct
11201120- type t = Paths_types.Resolved_reference.class_signature
12241224+ type ('lmod, 'lmodty, 'pty) gen =
12251225+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.class_signature
12261226+ type t = (na, na, na) gen
11211227 end
1122122811231229 module DataType = struct
11241124- type t = Paths_types.Resolved_reference.datatype
12301230+ type ('lmod, 'lmodty, 'pty) gen =
12311231+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.datatype
12321232+ type t = (na, na, na) gen
11251233 end
1126123411271235 module FieldParent = struct
11281128- type t = Paths_types.Resolved_reference.field_parent
12361236+ type ('lmod, 'lmodty, 'pty) gen =
12371237+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.field_parent
12381238+ type t = (na, na, na) gen
11291239 end
1130124011311241 module UnboxedFieldParent = struct
11321132- type t = Paths_types.Resolved_reference.unboxed_field_parent
12421242+ type ('lmod, 'lmodty, 'pty) gen =
12431243+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.unboxed_field_parent
12441244+ type t = (na, na, na) gen
11331245 end
1134124611351247 module LabelParent = struct
11361136- type t = Paths_types.Resolved_reference.label_parent
12481248+ type ('lmod, 'lmodty, 'pty) gen =
12491249+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.label_parent
12501250+ type t = (na, na, na) gen
11371251 end
1138125211391253 module Module = struct
11401140- type t = Paths_types.Resolved_reference.module_
12541254+ type ('lmod, 'lmodty, 'pty) gen =
12551255+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.module_
12561256+ type t = (na, na, na) gen
11411257 end
1142125811431259 module ModuleType = struct
11441144- type t = Paths_types.Resolved_reference.module_type
12601260+ type ('lmod, 'lmodty, 'pty) gen =
12611261+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.module_type
12621262+ type t = (na, na, na) gen
11451263 end
1146126411471265 module Type = struct
11481148- type t = Paths_types.Resolved_reference.type_
12661266+ type ('lmod, 'lmodty, 'pty) gen =
12671267+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.type_
12681268+ type t = (na, na, na) gen
11491269 end
1150127011511271 module Constructor = struct
11521152- type t = Paths_types.Resolved_reference.constructor
12721272+ type ('lmod, 'lmodty, 'pty) gen =
12731273+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.constructor
12741274+ type t = (na, na, na) gen
11531275 end
1154127611551277 module Field = struct
11561156- type t = Paths_types.Resolved_reference.field
12781278+ type ('lmod, 'lmodty, 'pty) gen =
12791279+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.field
12801280+ type t = (na, na, na) gen
11571281 end
1158128211591283 module UnboxedField = struct
11601160- type t = Paths_types.Resolved_reference.unboxed_field
12841284+ type ('lmod, 'lmodty, 'pty) gen =
12851285+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.unboxed_field
12861286+ type t = (na, na, na) gen
11611287 end
1162128811631289 module Extension = struct
11641164- type t = Paths_types.Resolved_reference.extension
12901290+ type ('lmod, 'lmodty, 'pty) gen =
12911291+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.extension
12921292+ type t = (na, na, na) gen
11651293 end
1166129411671295 module ExtensionDecl = struct
11681168- type t = Paths_types.Resolved_reference.extension_decl
12961296+ type ('lmod, 'lmodty, 'pty) gen =
12971297+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.extension_decl
12981298+ type t = (na, na, na) gen
11691299 end
1170130011711301 module Exception = struct
11721172- type t = Paths_types.Resolved_reference.exception_
13021302+ type ('lmod, 'lmodty, 'pty) gen =
13031303+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.exception_
13041304+ type t = (na, na, na) gen
11731305 end
1174130611751307 module Value = struct
11761176- type t = Paths_types.Resolved_reference.value
13081308+ type ('lmod, 'lmodty, 'pty) gen =
13091309+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.value
13101310+ type t = (na, na, na) gen
11771311 end
1178131211791313 module Class = struct
11801180- type t = Paths_types.Resolved_reference.class_
13141314+ type ('lmod, 'lmodty, 'pty) gen =
13151315+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.class_
13161316+ type t = (na, na, na) gen
11811317 end
1182131811831319 module ClassType = struct
11841184- type t = Paths_types.Resolved_reference.class_type
13201320+ type ('lmod, 'lmodty, 'pty) gen =
13211321+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.class_type
13221322+ type t = (na, na, na) gen
11851323 end
1186132411871325 module Method = struct
11881188- type t = Paths_types.Resolved_reference.method_
13261326+ type ('lmod, 'lmodty, 'pty) gen =
13271327+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.method_
13281328+ type t = (na, na, na) gen
11891329 end
1190133011911331 module InstanceVariable = struct
11921192- type t = Paths_types.Resolved_reference.instance_variable
13321332+ type ('lmod, 'lmodty, 'pty) gen =
13331333+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.instance_variable
13341334+ type t = (na, na, na) gen
11931335 end
1194133611951337 module Label = struct
11961196- type t = Paths_types.Resolved_reference.label
13381338+ type ('lmod, 'lmodty, 'pty) gen =
13391339+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.label
13401340+ type t = (na, na, na) gen
11971341 end
1198134211991343 module Page = struct
···12071351 end
12081352 end
1209135312101210- type t = Paths_types.Reference.any
13541354+ type ('lmod, 'lmodty, 'pty) gen =
13551355+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.any
13561356+ type t = (na, na, na) gen
1211135712121358 type tag_any = Paths_types.Reference.tag_any
12131359 type tag_hierarchy = Paths_types.Reference.tag_hierarchy
1214136012151361 module Signature = struct
12161216- type t = Paths_types.Reference.signature
13621362+ type ('lmod, 'lmodty, 'pty) gen =
13631363+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.signature
13641364+ type t = (na, na, na) gen
12171365 end
1218136612191367 module ClassSignature = struct
12201220- type t = Paths_types.Reference.class_signature
13681368+ type ('lmod, 'lmodty, 'pty) gen =
13691369+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.class_signature
13701370+ type t = (na, na, na) gen
12211371 end
1222137212231373 module DataType = struct
12241224- type t = Paths_types.Reference.datatype
13741374+ type ('lmod, 'lmodty, 'pty) gen =
13751375+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.datatype
13761376+ type t = (na, na, na) gen
12251377 end
1226137812271379 module FragmentTypeParent = struct
12281228- type t = Paths_types.Reference.fragment_type_parent
13801380+ type ('lmod, 'lmodty, 'pty) gen =
13811381+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.fragment_type_parent
13821382+ type t = (na, na, na) gen
12291383 end
1230138412311385 module LabelParent = struct
12321232- type t = Paths_types.Reference.label_parent
13861386+ type ('lmod, 'lmodty, 'pty) gen =
13871387+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.label_parent
13881388+ type t = (na, na, na) gen
12331389 end
1234139012351391 module Module = struct
12361236- type t = Paths_types.Reference.module_
13921392+ type ('lmod, 'lmodty, 'pty) gen =
13931393+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.module_
13941394+ type t = (na, na, na) gen
12371395 end
1238139612391397 module ModuleType = struct
12401240- type t = Paths_types.Reference.module_type
13981398+ type ('lmod, 'lmodty, 'pty) gen =
13991399+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.module_type
14001400+ type t = (na, na, na) gen
12411401 end
1242140212431403 module Type = struct
12441244- type t = Paths_types.Reference.type_
14041404+ type ('lmod, 'lmodty, 'pty) gen =
14051405+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.type_
14061406+ type t = (na, na, na) gen
12451407 end
1246140812471409 module Constructor = struct
12481248- type t = Paths_types.Reference.constructor
14101410+ type ('lmod, 'lmodty, 'pty) gen =
14111411+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.constructor
14121412+ type t = (na, na, na) gen
12491413 end
1250141412511415 module Field = struct
12521252- type t = Paths_types.Reference.field
14161416+ type ('lmod, 'lmodty, 'pty) gen =
14171417+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.field
14181418+ type t = (na, na, na) gen
12531419 end
1254142012551421 module UnboxedField = struct
12561256- type t = Paths_types.Reference.unboxed_field
14221422+ type ('lmod, 'lmodty, 'pty) gen =
14231423+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.unboxed_field
14241424+ type t = (na, na, na) gen
12571425 end
1258142612591427 module Extension = struct
12601260- type t = Paths_types.Reference.extension
14281428+ type ('lmod, 'lmodty, 'pty) gen =
14291429+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.extension
14301430+ type t = (na, na, na) gen
12611431 end
1262143212631433 module ExtensionDecl = struct
12641264- type t = Paths_types.Reference.extension_decl
14341434+ type ('lmod, 'lmodty, 'pty) gen =
14351435+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.extension_decl
14361436+ type t = (na, na, na) gen
12651437 end
1266143812671439 module Exception = struct
12681268- type t = Paths_types.Reference.exception_
14401440+ type ('lmod, 'lmodty, 'pty) gen =
14411441+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.exception_
14421442+ type t = (na, na, na) gen
12691443 end
1270144412711445 module Value = struct
12721272- type t = Paths_types.Reference.value
14461446+ type ('lmod, 'lmodty, 'pty) gen =
14471447+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.value
14481448+ type t = (na, na, na) gen
12731449 end
1274145012751451 module Class = struct
12761276- type t = Paths_types.Reference.class_
14521452+ type ('lmod, 'lmodty, 'pty) gen =
14531453+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.class_
14541454+ type t = (na, na, na) gen
12771455 end
1278145612791457 module ClassType = struct
12801280- type t = Paths_types.Reference.class_type
14581458+ type ('lmod, 'lmodty, 'pty) gen =
14591459+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.class_type
14601460+ type t = (na, na, na) gen
12811461 end
1282146212831463 module Method = struct
12841284- type t = Paths_types.Reference.method_
14641464+ type ('lmod, 'lmodty, 'pty) gen =
14651465+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.method_
14661466+ type t = (na, na, na) gen
12851467 end
1286146812871469 module InstanceVariable = struct
12881288- type t = Paths_types.Reference.instance_variable
14701470+ type ('lmod, 'lmodty, 'pty) gen =
14711471+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.instance_variable
14721472+ type t = (na, na, na) gen
12891473 end
1290147412911475 module Label = struct
12921292- type t = Paths_types.Reference.label
14761476+ type ('lmod, 'lmodty, 'pty) gen =
14771477+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.label
14781478+ type t = (na, na, na) gen
12931479 end
1294148012951481 module Page = struct
12961296- type t = Paths_types.Reference.page
14821482+ type ('lmod, 'lmodty, 'pty) gen =
14831483+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.page
14841484+ type t = (na, na, na) gen
12971485 end
1298148612991487 module Asset = struct
+237-70
odoc/src/model/paths.mli
···1717module Ocaml_ident = Ident
1818module Ocaml_env = Env
19192020+type na_ty = |
2121+type na = [ `Na of na_ty ]
2222+2023(** Identifiers for definitions *)
21242225module Identifier : sig
···368371369372(** Normal OCaml paths (i.e. the ones present in types) *)
370373module rec Path : sig
374374+ type ('lmod, 'lmodty, 'pty, 'a) genfn3 = {
375375+ lmod : 'lmod -> 'a;
376376+ lmodty : 'lmodty -> 'a;
377377+ pty : 'pty -> 'a;
378378+ }
379379+380380+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval, 'a) genfn5 = {
381381+ g : ('lmod, 'lmodty, 'pty, 'a) genfn3;
382382+ lty : 'lty -> 'a;
383383+ lval : 'lval -> 'a;
384384+ }
385385+386386+ val is_resolved_hidden_gen :
387387+ weak_canonical_test:bool ->
388388+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
389389+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) Paths_types.Resolved_path.any ->
390390+ bool
391391+392392+ val is_hidden_gen :
393393+ ('lmod, 'lmodty, 'pty, 'lty, 'lval, bool) genfn5 ->
394394+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) Paths_types.Path.any ->
395395+ bool
396396+371397 module Resolved : sig
372398 module Module : sig
373373- type t = Paths_types.Resolved_path.module_
399399+ type ('lmod, 'lmodty, 'pty) gen =
400400+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_path.module_
401401+ type t = (na, na, na) gen
374402375403 val is_hidden : t -> weak_canonical_test:bool -> bool
376404···380408 end
381409382410 module ModuleType : sig
383383- type t = Paths_types.Resolved_path.module_type
411411+ type ('lmod, 'lmodty, 'pty) gen =
412412+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_path.module_type
413413+ type t = (na, na, na) gen
384414385415 (* val is_hidden : t -> weak_canonical_test:bool -> bool *)
386416···388418 end
389419390420 module Type : sig
391391- type t = Paths_types.Resolved_path.type_
421421+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
422422+ ('lmod, 'lmodty, 'pty, 'lty) Paths_types.Resolved_path.type_
423423+ type t = (na, na, na, na) gen
392424393425 (* val of_ident : Identifier.Path.Type.t -> t *)
394426···398430 end
399431400432 module Value : sig
401401- type t = Paths_types.Resolved_path.value
433433+ type ('lmod, 'lmodty, 'pty, 'lval) gen =
434434+ ('lmod, 'lmodty, 'pty, 'lval) Paths_types.Resolved_path.value
435435+ type t = (na, na, na, na) gen
402436 end
403437404438 module ClassType : sig
405405- type t = Paths_types.Resolved_path.class_type
439439+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
440440+ ('lmod, 'lmodty, 'pty, 'lty) Paths_types.Resolved_path.class_type
441441+ type t = (na, na, na, na) gen
406442407443 (* val of_ident : Identifier.Path.ClassType.t -> t *)
408444409445 (* val is_hidden : t -> bool *)
410446 end
411447412412- type t = Paths_types.Resolved_path.any
448448+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval) gen =
449449+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) Paths_types.Resolved_path.any
450450+ type t = (na, na, na, na, na) gen
451451+ type parent = (na, na, na) Paths_types.Resolved_path.parent
452452+ type ('lmod, 'lmodty, 'pty) parent_gen =
453453+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_path.parent
413454414455 val identifier : t -> Identifier.t option
415456 (** If the path points to a core type, no identifier can be generated *)
···418459 end
419460420461 module Module : sig
421421- type t = Paths_types.Path.module_
462462+ type ('lmod, 'lmodty, 'pty) gen =
463463+ ('lmod, 'lmodty, 'pty) Paths_types.Path.module_
464464+ type t = (na, na, na) gen
422465423466 (* val root : t -> string option *)
424467 end
425468426469 module ModuleType : sig
427427- type t = Paths_types.Path.module_type
470470+ type ('lmod, 'lmodty, 'pty) gen =
471471+ ('lmod, 'lmodty, 'pty) Paths_types.Path.module_type
472472+ type t = (na, na, na) gen
428473 end
429474430475 module Type : sig
431431- type t = Paths_types.Path.type_
476476+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
477477+ ('lmod, 'lmodty, 'pty, 'lty) Paths_types.Path.type_
478478+ type t = (na, na, na, na) gen
432479 end
433480434481 module Value : sig
435435- type t = Paths_types.Path.value
482482+ type ('lmod, 'lmodty, 'pty, 'lval) gen =
483483+ ('lmod, 'lmodty, 'pty, 'lval) Paths_types.Path.value
484484+ type t = (na, na, na, na) gen
436485 end
437486438487 module ClassType : sig
439439- type t = Paths_types.Path.class_type
488488+ type ('lmod, 'lmodty, 'pty, 'lty) gen =
489489+ ('lmod, 'lmodty, 'pty, 'lty) Paths_types.Path.class_type
490490+ type t = (na, na, na, na) gen
440491 end
441492442442- type t = Paths_types.Path.any
493493+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval) gen =
494494+ ('lmod, 'lmodty, 'pty, 'lty, 'lval) Paths_types.Path.any
495495+ type t = (na, na, na, na, na) gen
443496444497 val is_hidden : t -> bool
445498end
···448501module Fragment : sig
449502 module Resolved : sig
450503 module Signature : sig
451451- type t = Paths_types.Resolved_fragment.signature
504504+ type ('lmod, 'lmodty, 'pty) gen =
505505+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.signature
506506+ type t = (na, na, na) gen
452507 end
453508454509 module Module : sig
455455- type t = Paths_types.Resolved_fragment.module_
510510+ type ('lmod, 'lmodty, 'pty) gen =
511511+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.module_
512512+ type t = (na, na, na) gen
456513 end
457514458515 module ModuleType : sig
459459- type t = Paths_types.Resolved_fragment.module_type
516516+ type ('lmod, 'lmodty, 'pty) gen =
517517+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.module_type
518518+ type t = (na, na, na) gen
460519 end
461520462521 module Type : sig
463463- type t = Paths_types.Resolved_fragment.type_
522522+ type ('lmod, 'lmodty, 'pty) gen =
523523+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.type_
524524+ type t = (na, na, na) gen
464525 end
465526466466- type leaf = Paths_types.Resolved_fragment.leaf
527527+ type ('lmod, 'lmodty, 'pty) leaf_gen =
528528+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.leaf
529529+ type leaf = (na, na, na) leaf_gen
467530468468- type root = Paths_types.Resolved_fragment.root
531531+ type ('lmod, 'lmodty, 'pty) root_gen =
532532+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.root
533533+ type root = (na, na, na) root_gen
469534470470- type t = Paths_types.Resolved_fragment.any
535535+ type ('lmod, 'lmodty, 'pty) gen =
536536+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_fragment.any
537537+ type t = (na, na, na) gen
471538472472- val identifier : t -> Identifier.t option
539539+ val identifier : t -> Identifier.t
473540474541 val is_hidden : t -> bool
475542 end
476543477544 module Signature : sig
478478- type t = Paths_types.Fragment.signature
545545+ type ('lmod, 'lmodty, 'pty) gen =
546546+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.signature
547547+ type t = (na, na, na) gen
479548 end
480549481550 module Module : sig
482482- type t = Paths_types.Fragment.module_
551551+ type ('lmod, 'lmodty, 'pty) gen =
552552+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.module_
553553+ type t = (na, na, na) gen
483554 end
484555485556 module ModuleType : sig
486486- type t = Paths_types.Fragment.module_type
557557+ type ('lmod, 'lmodty, 'pty) gen =
558558+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.module_type
559559+ type t = (na, na, na) gen
487560 end
488561489562 module Type : sig
490490- type t = Paths_types.Fragment.type_
563563+ type ('lmod, 'lmodty, 'pty) gen =
564564+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.type_
565565+ type t = (na, na, na) gen
491566 end
492567493493- type leaf = Paths_types.Fragment.leaf
568568+ type ('lmod, 'lmodty, 'pty) leaf_gen =
569569+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.leaf
570570+ type leaf = (na, na, na) leaf_gen
494571495495- type t = Paths_types.Fragment.any
572572+ type ('lmod, 'lmodty, 'pty) gen =
573573+ ('lmod, 'lmodty, 'pty) Paths_types.Fragment.any
574574+ type t = (na, na, na) gen
496575end
497576498577(** References present in documentation comments ([{!Foo.Bar}]) *)
499578module rec Reference : sig
500579 module Resolved : sig
501580 module Signature : sig
502502- type t = Paths_types.Resolved_reference.signature
581581+ type ('lmod, 'lmodty, 'pty) gen =
582582+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.signature
583583+ type t = (na, na, na) gen
503584 end
504585505586 module ClassSignature : sig
506506- type t = Paths_types.Resolved_reference.class_signature
587587+ type ('lmod, 'lmodty, 'pty) gen =
588588+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.class_signature
589589+ type t = (na, na, na) gen
507590 end
508591509592 module DataType : sig
510510- type t = Paths_types.Resolved_reference.datatype
593593+ type ('lmod, 'lmodty, 'pty) gen =
594594+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.datatype
595595+ type t = (na, na, na) gen
511596 end
512597513598 module FieldParent : sig
514514- type t = Paths_types.Resolved_reference.field_parent
599599+ type ('lmod, 'lmodty, 'pty) gen =
600600+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.field_parent
601601+ type t = (na, na, na) gen
515602 end
516603517604 module UnboxedFieldParent : sig
518518- type t = Paths_types.Resolved_reference.unboxed_field_parent
605605+ type ('lmod, 'lmodty, 'pty) gen =
606606+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.unboxed_field_parent
607607+ type t = (na, na, na) gen
519608 end
520609521610 module LabelParent : sig
522522- type t = Paths_types.Resolved_reference.label_parent
611611+ type ('lmod, 'lmodty, 'pty) gen =
612612+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.label_parent
613613+ type t = (na, na, na) gen
523614 end
524615525616 module Module : sig
526526- type t = Paths_types.Resolved_reference.module_
617617+ type ('lmod, 'lmodty, 'pty) gen =
618618+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.module_
619619+ type t = (na, na, na) gen
527620 end
528621529622 module ModuleType : sig
530530- type t = Paths_types.Resolved_reference.module_type
623623+ type ('lmod, 'lmodty, 'pty) gen =
624624+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.module_type
625625+ type t = (na, na, na) gen
531626 end
532627533628 module Type : sig
534534- type t = Paths_types.Resolved_reference.type_
629629+ type ('lmod, 'lmodty, 'pty) gen =
630630+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.type_
631631+ type t = (na, na, na) gen
535632 end
536633537634 module Constructor : sig
538538- type t = Paths_types.Resolved_reference.constructor
635635+ type ('lmod, 'lmodty, 'pty) gen =
636636+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.constructor
637637+ type t = (na, na, na) gen
539638 end
540639541640 module Field : sig
542542- type t = Paths_types.Resolved_reference.field
641641+ type ('lmod, 'lmodty, 'pty) gen =
642642+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.field
643643+ type t = (na, na, na) gen
543644 end
544645545646 module UnboxedField : sig
546546- type t = Paths_types.Resolved_reference.unboxed_field
647647+ type ('lmod, 'lmodty, 'pty) gen =
648648+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.unboxed_field
649649+ type t = (na, na, na) gen
547650 end
548651549652 module Extension : sig
550550- type t = Paths_types.Resolved_reference.extension
653653+ type ('lmod, 'lmodty, 'pty) gen =
654654+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.extension
655655+ type t = (na, na, na) gen
551656 end
552657553658 module ExtensionDecl : sig
554554- type t = Paths_types.Resolved_reference.extension_decl
659659+ type ('lmod, 'lmodty, 'pty) gen =
660660+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.extension_decl
661661+ type t = (na, na, na) gen
555662 end
556663557664 module Exception : sig
558558- type t = Paths_types.Resolved_reference.exception_
665665+ type ('lmod, 'lmodty, 'pty) gen =
666666+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.exception_
667667+ type t = (na, na, na) gen
559668 end
560669561670 module Value : sig
562562- type t = Paths_types.Resolved_reference.value
671671+ type ('lmod, 'lmodty, 'pty) gen =
672672+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.value
673673+ type t = (na, na, na) gen
563674 end
564675565676 module Class : sig
566566- type t = Paths_types.Resolved_reference.class_
677677+ type ('lmod, 'lmodty, 'pty) gen =
678678+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.class_
679679+ type t = (na, na, na) gen
567680 end
568681569682 module ClassType : sig
570570- type t = Paths_types.Resolved_reference.class_type
683683+ type ('lmod, 'lmodty, 'pty) gen =
684684+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.class_type
685685+ type t = (na, na, na) gen
571686 end
572687573688 module Method : sig
574574- type t = Paths_types.Resolved_reference.method_
689689+ type ('lmod, 'lmodty, 'pty) gen =
690690+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.method_
691691+ type t = (na, na, na) gen
575692 end
576693577694 module InstanceVariable : sig
578578- type t = Paths_types.Resolved_reference.instance_variable
695695+ type ('lmod, 'lmodty, 'pty) gen =
696696+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.instance_variable
697697+ type t = (na, na, na) gen
579698 end
580699581700 module Label : sig
582582- type t = Paths_types.Resolved_reference.label
701701+ type ('lmod, 'lmodty, 'pty) gen =
702702+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.label
703703+ type t = (na, na, na) gen
583704 end
584705585706 module Page : sig
···592713 val identifier : t -> Identifier.AssetFile.t
593714 end
594715595595- type t = Paths_types.Resolved_reference.any
716716+ type ('lmod, 'lmodty, 'pty) gen =
717717+ ('lmod, 'lmodty, 'pty) Paths_types.Resolved_reference.any
718718+ type t = (na, na, na) gen
596719597720 val identifier : t -> Identifier.t option
598721 end
599722600723 module Signature : sig
601601- type t = Paths_types.Reference.signature
724724+ type ('lmod, 'lmodty, 'pty) gen =
725725+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.signature
726726+ type t = (na, na, na) gen
602727 end
603728604729 module ClassSignature : sig
605605- type t = Paths_types.Reference.class_signature
730730+ type ('lmod, 'lmodty, 'pty) gen =
731731+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.class_signature
732732+ type t = (na, na, na) gen
606733 end
607734608735 module DataType : sig
609609- type t = Paths_types.Reference.datatype
736736+ type ('lmod, 'lmodty, 'pty) gen =
737737+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.datatype
738738+ type t = (na, na, na) gen
610739 end
611740612741 module FragmentTypeParent : sig
613613- type t = Paths_types.Reference.fragment_type_parent
742742+ type ('lmod, 'lmodty, 'pty) gen =
743743+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.fragment_type_parent
744744+ type t = (na, na, na) gen
614745 end
615746616747 module LabelParent : sig
617617- type t = Paths_types.Reference.label_parent
748748+ type ('lmod, 'lmodty, 'pty) gen =
749749+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.label_parent
750750+ type t = (na, na, na) gen
618751 end
619752620753 module Module : sig
621621- type t = Paths_types.Reference.module_
754754+ type ('lmod, 'lmodty, 'pty) gen =
755755+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.module_
756756+ type t = (na, na, na) gen
622757 end
623758624759 module ModuleType : sig
625625- type t = Paths_types.Reference.module_type
760760+ type ('lmod, 'lmodty, 'pty) gen =
761761+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.module_type
762762+ type t = (na, na, na) gen
626763 end
627764628765 module Type : sig
629629- type t = Paths_types.Reference.type_
766766+ type ('lmod, 'lmodty, 'pty) gen =
767767+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.type_
768768+ type t = (na, na, na) gen
630769 end
631770632771 module Constructor : sig
633633- type t = Paths_types.Reference.constructor
772772+ type ('lmod, 'lmodty, 'pty) gen =
773773+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.constructor
774774+ type t = (na, na, na) gen
634775 end
635776636777 module Field : sig
637637- type t = Paths_types.Reference.field
778778+ type ('lmod, 'lmodty, 'pty) gen =
779779+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.field
780780+ type t = (na, na, na) gen
638781 end
639782640783 module UnboxedField : sig
641641- type t = Paths_types.Reference.unboxed_field
784784+ type ('lmod, 'lmodty, 'pty) gen =
785785+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.unboxed_field
786786+ type t = (na, na, na) gen
642787 end
643788644789 module Extension : sig
645645- type t = Paths_types.Reference.extension
790790+ type ('lmod, 'lmodty, 'pty) gen =
791791+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.extension
792792+ type t = (na, na, na) gen
646793 end
647794648795 module ExtensionDecl : sig
649649- type t = Paths_types.Reference.extension_decl
796796+ type ('lmod, 'lmodty, 'pty) gen =
797797+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.extension_decl
798798+ type t = (na, na, na) gen
650799 end
651800652801 module Exception : sig
653653- type t = Paths_types.Reference.exception_
802802+ type ('lmod, 'lmodty, 'pty) gen =
803803+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.exception_
804804+ type t = (na, na, na) gen
654805 end
655806656807 module Value : sig
657657- type t = Paths_types.Reference.value
808808+ type ('lmod, 'lmodty, 'pty) gen =
809809+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.value
810810+ type t = (na, na, na) gen
658811 end
659812660813 module Class : sig
661661- type t = Paths_types.Reference.class_
814814+ type ('lmod, 'lmodty, 'pty) gen =
815815+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.class_
816816+ type t = (na, na, na) gen
662817 end
663818664819 module ClassType : sig
665665- type t = Paths_types.Reference.class_type
820820+ type ('lmod, 'lmodty, 'pty) gen =
821821+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.class_type
822822+ type t = (na, na, na) gen
666823 end
667824668825 module Method : sig
669669- type t = Paths_types.Reference.method_
826826+ type ('lmod, 'lmodty, 'pty) gen =
827827+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.method_
828828+ type t = (na, na, na) gen
670829 end
671830672831 module InstanceVariable : sig
673673- type t = Paths_types.Reference.instance_variable
832832+ type ('lmod, 'lmodty, 'pty) gen =
833833+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.instance_variable
834834+ type t = (na, na, na) gen
674835 end
675836676837 module Label : sig
677677- type t = Paths_types.Reference.label
838838+ type ('lmod, 'lmodty, 'pty) gen =
839839+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.label
840840+ type t = (na, na, na) gen
678841 end
679842680843 module Page : sig
681681- type t = Paths_types.Reference.page
844844+ type ('lmod, 'lmodty, 'pty) gen =
845845+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.page
846846+ type t = (na, na, na) gen
682847 end
683848684849 module Asset : sig
···689854 type t = Paths_types.Reference.hierarchy
690855 end
691856692692- type t = Paths_types.Reference.any
857857+ type ('lmod, 'lmodty, 'pty) gen =
858858+ ('lmod, 'lmodty, 'pty) Paths_types.Reference.any
859859+ type t = (na, na, na) gen
693860694861 type tag_any = Paths_types.Reference.tag_any
695862 type tag_hierarchy = Paths_types.Reference.tag_hierarchy
+452-338
odoc/src/model/paths_types.ml
···325325end
326326327327module rec Path : sig
328328- type module_ =
329329- [ `Resolved of Resolved_path.module_
328328+ type ('lmod, 'lmodty, 'pty) module_ =
329329+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_path.module_
330330 | `Identifier of Identifier.path_module * bool
331331- | `Substituted of module_
331331+ | `LocalMod of 'lmod
332332+ | `Substituted of ('lmod, 'lmodty, 'pty) module_
332333 | `Root of ModuleName.t
333334 | `Forward of string
334334- | `Dot of module_ * ModuleName.t
335335- | `Apply of module_ * module_ ]
336336- (** @canonical Odoc_model.Paths.Path.Module.t *)
335335+ | `Dot of ('lmod, 'lmodty, 'pty) module_ * ModuleName.t
336336+ | `Module of
337337+ 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * ModuleName.t
338338+ | `Apply of ('lmod, 'lmodty, 'pty) module_ * ('lmod, 'lmodty, 'pty) module_
339339+ ]
340340+ (** @canonical Odoc_model.Paths.Path.Module.gen *)
337341338338- type module_type =
339339- [ `Resolved of Resolved_path.module_type
340340- | `SubstitutedMT of module_type
342342+ type ('lmod, 'lmodty, 'pty) module_type =
343343+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_path.module_type
344344+ | `LocalModTy of 'lmodty
345345+ | `SubstitutedMT of ('lmod, 'lmodty, 'pty) module_type
341346 | `Identifier of Identifier.path_module_type * bool
342342- | `DotMT of module_ * ModuleTypeName.t ]
343343- (** @canonical Odoc_model.Paths.Path.ModuleType.t *)
347347+ | `DotMT of ('lmod, 'lmodty, 'pty) module_ * ModuleTypeName.t
348348+ | `ModuleType of
349349+ 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * ModuleTypeName.t ]
350350+ (** @canonical Odoc_model.Paths.Path.ModuleType.gen *)
344351345345- type type_ =
346346- [ `Resolved of Resolved_path.type_
347347- | `SubstitutedT of type_
352352+ type ('lmod, 'lmodty, 'pty, 'lty) class_type =
353353+ [ `Resolved of ('lmod, 'lmodty, 'pty, 'lty) Resolved_path.class_type
354354+ | `LocalTy of 'lty
355355+ | `SubstitutedCT of ('lmod, 'lmodty, 'pty, 'lty) class_type
356356+ | `Identifier of Identifier.path_class_type * bool
357357+ | `DotT of ('lmod, 'lmodty, 'pty) module_ * TypeName.t
358358+ | `Type of 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * TypeName.t
359359+ ]
360360+ (** @canonical Odoc_model.Paths.Path.ClassType.gen *)
361361+362362+ type ('lmod, 'lmodty, 'pty, 'lty) type_ =
363363+ [ `Resolved of ('lmod, 'lmodty, 'pty, 'lty) Resolved_path.type_
364364+ | `LocalTy of 'lty
365365+ | `SubstitutedT of ('lmod, 'lmodty, 'pty, 'lty) type_
366366+ | `SubstitutedCT of ('lmod, 'lmodty, 'pty, 'lty) class_type
348367 | `Identifier of Identifier.path_type * bool
349349- | `DotT of module_ * TypeName.t ]
350350- (** @canonical Odoc_model.Paths.Path.Type.t *)
368368+ | `DotT of ('lmod, 'lmodty, 'pty) module_ * TypeName.t
369369+ | `Type of 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * TypeName.t
370370+ ]
371371+ (** @canonical Odoc_model.Paths.Path.Type.gen *)
351372352352- type value =
353353- [ `Resolved of Resolved_path.value
373373+ type ('lmod, 'lmodty, 'pty, 'lval) value =
374374+ [ `Resolved of ('lmod, 'lmodty, 'pty, 'lval) Resolved_path.value
375375+ | `LocalVal of 'lval
354376 | `Identifier of Identifier.path_value * bool
355355- | `DotV of module_ * ValueName.t ]
356356- (** @canonical Odoc_model.Paths.Path.Value.t *)
377377+ | `DotV of ('lmod, 'lmodty, 'pty) module_ * ValueName.t ]
378378+ (** @canonical Odoc_model.Paths.Path.Value.gen *)
357379358358- type class_type =
359359- [ `Resolved of Resolved_path.class_type
360360- | `SubstitutedCT of class_type
361361- | `Identifier of Identifier.path_class_type * bool
362362- | `DotT of module_ * TypeName.t ]
363363- (** @canonical Odoc_model.Paths.Path.ClassType.t *)
364364-365365- type any =
366366- [ `Resolved of Resolved_path.any
367367- | `SubstitutedT of type_
368368- | `SubstitutedMT of module_type
369369- | `Substituted of module_
370370- | `SubstitutedCT of class_type
380380+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval) any =
381381+ [ `Resolved of ('lmod, 'lmodty, 'pty, 'lty, 'lval) Resolved_path.any
382382+ | `SubstitutedT of ('lmod, 'lmodty, 'pty, 'lty) type_
383383+ | `SubstitutedMT of ('lmod, 'lmodty, 'pty) module_type
384384+ | `Substituted of ('lmod, 'lmodty, 'pty) module_
385385+ | `SubstitutedCT of ('lmod, 'lmodty, 'pty, 'lty) class_type
371386 | `Identifier of Identifier.path_any * bool
372387 | `Root of ModuleName.t
373388 | `Forward of string
374374- | `Dot of module_ * ModuleName.t
375375- | `DotT of module_ * TypeName.t
376376- | `DotMT of module_ * ModuleTypeName.t
377377- | `DotV of module_ * ValueName.t
378378- | `Apply of module_ * module_ ]
379379- (** @canonical Odoc_model.Paths.Path.t *)
389389+ | `Dot of ('lmod, 'lmodty, 'pty) module_ * ModuleName.t
390390+ | `DotT of ('lmod, 'lmodty, 'pty) module_ * TypeName.t
391391+ | `DotMT of ('lmod, 'lmodty, 'pty) module_ * ModuleTypeName.t
392392+ | `DotV of ('lmod, 'lmodty, 'pty) module_ * ValueName.t
393393+ | `Apply of ('lmod, 'lmodty, 'pty) module_ * ('lmod, 'lmodty, 'pty) module_
394394+ | `Type of 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * TypeName.t
395395+ | `ModuleType of
396396+ 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * ModuleTypeName.t
397397+ | `Module of
398398+ 'pty * ('lmod, 'lmodty, 'pty) Resolved_path.parent * ModuleName.t
399399+ | `LocalMod of 'lmod
400400+ | `LocalModTy of 'lmodty
401401+ | `LocalVal of 'lval
402402+ | `LocalTy of 'lty ]
403403+ (** @canonical Odoc_model.Paths.Path.gen *)
380404end =
381405 Path
382406383407and Resolved_path : sig
384384- type module_ =
408408+ type ('lmod, 'lmodty, 'pty) parent =
409409+ [ `Module of ('lmod, 'lmodty, 'pty) module_
410410+ | `ModuleType of ('lmod, 'lmodty, 'pty) module_type * 'pty
411411+ | `FragmentRoot of 'pty ]
412412+413413+ and ('lmod, 'lmodty, 'pty) module_ =
385414 [ `Identifier of Identifier.path_module
386386- | `Subst of module_type * module_
387387- | `Substituted of module_
388388- | `Hidden of module_
389389- | `Module of module_ * ModuleName.t
390390- | `Canonical of module_ * Path.module_ (** [`Canonical (mod, canonical)] *)
391391- | `Apply of module_ * module_ (** [`Apply (functor, argument)] *)
392392- | `Alias of module_ * Path.module_ (** Resolved dest *)
393393- | `OpaqueModule of module_ ]
415415+ | `LocalMod of 'lmod
416416+ | `Subst of
417417+ ('lmod, 'lmodty, 'pty) module_type * ('lmod, 'lmodty, 'pty) module_
418418+ | `Substituted of ('lmod, 'lmodty, 'pty) module_
419419+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
420420+ | `Module of ('lmod, 'lmodty, 'pty) parent * ModuleName.t
421421+ | `Canonical of
422422+ ('lmod, 'lmodty, 'pty) module_ * ('lmod, 'lmodty, 'pty) Path.module_
423423+ (** [`Canonical (mod, canonical)] *)
424424+ | `Apply of ('lmod, 'lmodty, 'pty) module_ * ('lmod, 'lmodty, 'pty) module_
425425+ (** [`Apply (functor, argument)] *)
426426+ | `Alias of
427427+ ('lmod, 'lmodty, 'pty) module_
428428+ * ('lmod, 'lmodty, 'pty) Path.module_
429429+ * ('lmod, 'lmodty, 'pty) module_ option
430430+ (** Resolved dest *)
431431+ | `OpaqueModule of ('lmod, 'lmodty, 'pty) module_ ]
394432 (** @canonical Odoc_model.Paths.Path.Resolved.Module.t *)
395433396396- and module_type =
434434+ and ('lmod, 'lmodty, 'pty) module_type =
397435 [ `Identifier of Identifier.path_module_type
398398- | `SubstT of module_type * module_type
399399- | `SubstitutedMT of module_type
400400- | `CanonicalModuleType of module_type * Path.module_type
401401- | `AliasModuleType of module_type * module_type
402402- | `ModuleType of module_ * ModuleTypeName.t
403403- | `OpaqueModuleType of module_type ]
436436+ | `LocalModTy of 'lmodty
437437+ | `SubstT of
438438+ ('lmod, 'lmodty, 'pty) module_type * ('lmod, 'lmodty, 'pty) module_type
439439+ | `SubstitutedMT of ('lmod, 'lmodty, 'pty) module_type
440440+ | `CanonicalModuleType of
441441+ ('lmod, 'lmodty, 'pty) module_type
442442+ * ('lmod, 'lmodty, 'pty) Path.module_type
443443+ | `AliasModuleType of
444444+ ('lmod, 'lmodty, 'pty) module_type * ('lmod, 'lmodty, 'pty) module_type
445445+ | `ModuleType of ('lmod, 'lmodty, 'pty) parent * ModuleTypeName.t
446446+ | `OpaqueModuleType of ('lmod, 'lmodty, 'pty) module_type ]
404447 (** @canonical Odoc_model.Paths.Path.Resolved.ModuleType.t *)
405448406406- type value =
407407- [ `Identifier of Identifier.path_value | `Value of module_ * ValueName.t ]
449449+ type ('lmod, 'lmodty, 'pty, 'lval) value =
450450+ [ `Identifier of Identifier.path_value
451451+ | `LocalVal of 'lval
452452+ | `Value of ('lmod, 'lmodty, 'pty) parent * ValueName.t ]
408453 (** @canonical Odoc_model.Paths.Path.Resolved.Value.t *)
409454410410- type class_type =
455455+ type ('lmod, 'lmodty, 'pty, 'lty) class_type =
411456 [ `Identifier of Identifier.path_class_type
412412- | `SubstitutedCT of class_type
413413- | `Class of module_ * TypeName.t
414414- | `ClassType of module_ * TypeName.t ]
457457+ | `LocalTy of 'lty
458458+ | `SubstitutedCT of ('lmod, 'lmodty, 'pty, 'lty) class_type
459459+ | `Class of ('lmod, 'lmodty, 'pty) parent * TypeName.t
460460+ | `ClassType of ('lmod, 'lmodty, 'pty) parent * TypeName.t ]
415461416416- type type_ =
462462+ type ('lmod, 'lmodty, 'pty, 'lty) type_ =
417463 [ `Identifier of Identifier.path_type
418418- | `SubstitutedT of type_
419419- | `SubstitutedCT of class_type
420420- | `CanonicalType of type_ * Path.type_
421421- | `Type of module_ * TypeName.t
422422- | `Class of module_ * TypeName.t
423423- | `ClassType of module_ * TypeName.t
464464+ | `LocalTy of 'lty
465465+ | `SubstitutedT of ('lmod, 'lmodty, 'pty, 'lty) type_
466466+ | `SubstitutedCT of ('lmod, 'lmodty, 'pty, 'lty) class_type
467467+ | `CanonicalType of
468468+ ('lmod, 'lmodty, 'pty, 'lty) type_
469469+ * ('lmod, 'lmodty, 'pty, 'lty) Path.type_
470470+ | `Type of ('lmod, 'lmodty, 'pty) parent * TypeName.t
471471+ | `Class of ('lmod, 'lmodty, 'pty) parent * TypeName.t
472472+ | `ClassType of ('lmod, 'lmodty, 'pty) parent * TypeName.t
424473 | `CoreType of TypeName.t ]
425474 (** @canonical Odoc_model.Paths.Path.Resolved.Type.t *)
426475427427- type any =
476476+ type ('lmod, 'lmodty, 'pty, 'lty, 'lval) any =
428477 [ `Identifier of Identifier.any
429429- | `SubstitutedCT of class_type
430430- | `SubstitutedT of type_
431431- | `SubstitutedMT of module_type
432432- | `Substituted of module_
433433- | `Subst of module_type * module_
434434- | `Hidden of module_
435435- | `Module of module_ * ModuleName.t
436436- | `Canonical of module_ * Path.module_
437437- | `Apply of module_ * module_
438438- | `Alias of module_ * Path.module_
439439- | `AliasModuleType of module_type * module_type
440440- | `OpaqueModule of module_
441441- | `ModuleType of module_ * ModuleTypeName.t
442442- | `CanonicalModuleType of module_type * Path.module_type
443443- | `SubstT of module_type * module_type
444444- | `OpaqueModuleType of module_type
445445- | `CanonicalType of type_ * Path.type_
446446- | `Type of module_ * TypeName.t
447447- | `Class of module_ * TypeName.t
448448- | `ClassType of module_ * TypeName.t
449449- | `Class of module_ * TypeName.t
450450- | `Value of module_ * ValueName.t
451451- | `ClassType of module_ * TypeName.t
478478+ | `SubstitutedCT of ('lmod, 'lmodty, 'pty, 'lty) class_type
479479+ | `SubstitutedT of ('lmod, 'lmodty, 'pty, 'lty) type_
480480+ | `SubstitutedMT of ('lmod, 'lmodty, 'pty) module_type
481481+ | `Substituted of ('lmod, 'lmodty, 'pty) module_
482482+ | `Subst of
483483+ ('lmod, 'lmodty, 'pty) module_type * ('lmod, 'lmodty, 'pty) module_
484484+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
485485+ | `Module of ('lmod, 'lmodty, 'pty) parent * ModuleName.t
486486+ | `Canonical of
487487+ ('lmod, 'lmodty, 'pty) module_ * ('lmod, 'lmodty, 'pty) Path.module_
488488+ | `Apply of ('lmod, 'lmodty, 'pty) module_ * ('lmod, 'lmodty, 'pty) module_
489489+ | `Alias of
490490+ ('lmod, 'lmodty, 'pty) module_
491491+ * ('lmod, 'lmodty, 'pty) Path.module_
492492+ * ('lmod, 'lmodty, 'pty) module_ option
493493+ | `AliasModuleType of
494494+ ('lmod, 'lmodty, 'pty) module_type * ('lmod, 'lmodty, 'pty) module_type
495495+ | `OpaqueModule of ('lmod, 'lmodty, 'pty) module_
496496+ | `ModuleType of ('lmod, 'lmodty, 'pty) parent * ModuleTypeName.t
497497+ | `CanonicalModuleType of
498498+ ('lmod, 'lmodty, 'pty) module_type
499499+ * ('lmod, 'lmodty, 'pty) Path.module_type
500500+ | `SubstT of
501501+ ('lmod, 'lmodty, 'pty) module_type * ('lmod, 'lmodty, 'pty) module_type
502502+ | `OpaqueModuleType of ('lmod, 'lmodty, 'pty) module_type
503503+ | `CanonicalType of
504504+ ('lmod, 'lmodty, 'pty, 'lty) type_
505505+ * ('lmod, 'lmodty, 'pty, 'lty) Path.type_
506506+ | `Type of ('lmod, 'lmodty, 'pty) parent * TypeName.t
507507+ | `Class of ('lmod, 'lmodty, 'pty) parent * TypeName.t
508508+ | `ClassType of ('lmod, 'lmodty, 'pty) parent * TypeName.t
509509+ | `Class of ('lmod, 'lmodty, 'pty) parent * TypeName.t
510510+ | `Value of ('lmod, 'lmodty, 'pty) parent * ValueName.t
511511+ | `ClassType of ('lmod, 'lmodty, 'pty) parent * TypeName.t
512512+ | `LocalMod of 'lmod
513513+ | `LocalModTy of 'lmodty
514514+ | `LocalVal of 'lval
515515+ | `LocalTy of 'lty
452516 | `CoreType of TypeName.t ]
453517 (** @canonical Odoc_model.Paths.Path.Resolved.t *)
454518end =
455519 Resolved_path
456520457521module rec Fragment : sig
458458- type signature =
459459- [ `Resolved of Resolved_fragment.signature
460460- | `Dot of signature * string
522522+ type ('lmod, 'lmodty, 'pty) signature =
523523+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_fragment.signature
524524+ | `Dot of ('lmod, 'lmodty, 'pty) signature * string
461525 | `Root ]
462526 (** @canonical Odoc_model.Paths.Fragment.Signature.t *)
463527464464- type module_ =
465465- [ `Resolved of Resolved_fragment.module_ | `Dot of signature * string ]
528528+ type ('lmod, 'lmodty, 'pty) module_ =
529529+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_fragment.module_
530530+ | `Dot of ('lmod, 'lmodty, 'pty) signature * string ]
466531 (** @canonical Odoc_model.Paths.Fragment.Module.t *)
467532468468- type module_type =
469469- [ `Resolved of Resolved_fragment.module_type | `Dot of signature * string ]
533533+ type ('lmod, 'lmodty, 'pty) module_type =
534534+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_fragment.module_type
535535+ | `Dot of ('lmod, 'lmodty, 'pty) signature * string ]
470536 (** @canonical Odoc_model.Paths.Fragment.ModuleType.t *)
471537472472- type type_ =
473473- [ `Resolved of Resolved_fragment.type_ | `Dot of signature * string ]
538538+ type ('lmod, 'lmodty, 'pty) type_ =
539539+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_fragment.type_
540540+ | `Dot of ('lmod, 'lmodty, 'pty) signature * string ]
474541 (** @canonical Odoc_model.Paths.Fragment.Type.t *)
475542476476- type leaf =
477477- [ `Resolved of Resolved_fragment.leaf | `Dot of signature * string ]
543543+ type ('lmod, 'lmodty, 'pty) leaf =
544544+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_fragment.leaf
545545+ | `Dot of ('lmod, 'lmodty, 'pty) signature * string ]
478546 (** @canonical Odoc_model.Paths.Fragment.leaf *)
479547480480- type any =
481481- [ `Resolved of Resolved_fragment.any | `Dot of signature * string | `Root ]
548548+ type ('lmod, 'lmodty, 'pty) any =
549549+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_fragment.any
550550+ | `Dot of ('lmod, 'lmodty, 'pty) signature * string
551551+ | `Root ]
482552 (** @canonical Odoc_model.Paths.Fragment.t *)
483553end =
484554 Fragment
485555486556and Resolved_fragment : sig
487487- type root =
488488- [ `ModuleType of Resolved_path.module_type
489489- | `Module of Resolved_path.module_ ]
557557+ type ('lmod, 'lmodty, 'pty) root =
558558+ [ `ModuleType of ('lmod, 'lmodty, 'pty) Resolved_path.module_type
559559+ | `Module of ('lmod, 'lmodty, 'pty) Resolved_path.module_ ]
490560 (** @canonical Odoc_model.Paths.Fragment.Resolved.root *)
491561492492- type signature =
493493- [ `Root of root
494494- | `Subst of Resolved_path.module_type * module_
495495- | `Alias of Resolved_path.module_ * module_
496496- | `Module of signature * ModuleName.t
497497- | `OpaqueModule of module_ ]
562562+ type ('lmod, 'lmodty, 'pty) signature =
563563+ [ `Root of ('lmod, 'lmodty, 'pty) root
564564+ | `Subst of
565565+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
566566+ * ('lmod, 'lmodty, 'pty) module_
567567+ | `Alias of
568568+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
569569+ * ('lmod, 'lmodty, 'pty) module_
570570+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
571571+ | `OpaqueModule of ('lmod, 'lmodty, 'pty) module_ ]
498572 (** @canonical Odoc_model.Paths.Fragment.Resolved.Signature.t *)
499573500500- and module_ =
501501- [ `Subst of Resolved_path.module_type * module_
502502- | `Alias of Resolved_path.module_ * module_
503503- | `Module of signature * ModuleName.t
504504- | `OpaqueModule of module_ ]
574574+ and ('lmod, 'lmodty, 'pty) module_ =
575575+ [ `Subst of
576576+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
577577+ * ('lmod, 'lmodty, 'pty) module_
578578+ | `Alias of
579579+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
580580+ * ('lmod, 'lmodty, 'pty) module_
581581+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
582582+ | `OpaqueModule of ('lmod, 'lmodty, 'pty) module_ ]
505583 (** @canonical Odoc_model.Paths.Fragment.Resolved.Module.t *)
506584507507- type type_ =
508508- [ `Type of signature * TypeName.t
509509- | `Class of signature * TypeName.t
510510- | `ClassType of signature * TypeName.t ]
585585+ type ('lmod, 'lmodty, 'pty) type_ =
586586+ [ `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t
587587+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
588588+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
511589 (** @canonical Odoc_model.Paths.Fragment.Resolved.Type.t *)
512590513513- and module_type = [ `Module_type of signature * ModuleTypeName.t ]
591591+ and ('lmod, 'lmodty, 'pty) module_type =
592592+ [ `Module_type of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t ]
514593 (** @canonical Odoc_model.Paths.Fragment.Resolved.ModuleType.t *)
515594516516- type leaf = [ module_ | module_type | type_ ]
595595+ type ('lmod, 'lmodty, 'pty) leaf =
596596+ [ ('lmod, 'lmodty, 'pty) module_
597597+ | ('lmod, 'lmodty, 'pty) module_type
598598+ | ('lmod, 'lmodty, 'pty) type_ ]
517599 (** @canonical Odoc_model.Paths.Fragment.Resolved.leaf *)
518600519601 (* Absence of `Root here might make coersions annoying *)
520520- type any =
521521- [ `Root of root
522522- | `Subst of Resolved_path.module_type * module_
523523- | `Alias of Resolved_path.module_ * module_
524524- | `Module of signature * ModuleName.t
525525- | `Module_type of signature * ModuleTypeName.t
526526- | `Type of signature * TypeName.t
527527- | `Class of signature * TypeName.t
528528- | `ClassType of signature * TypeName.t
529529- | `OpaqueModule of module_ ]
602602+ type ('lmod, 'lmodty, 'pty) any =
603603+ [ `Root of ('lmod, 'lmodty, 'pty) root
604604+ | `Subst of
605605+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
606606+ * ('lmod, 'lmodty, 'pty) module_
607607+ | `Alias of
608608+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
609609+ * ('lmod, 'lmodty, 'pty) module_
610610+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
611611+ | `Module_type of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
612612+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t
613613+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
614614+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t
615615+ | `OpaqueModule of ('lmod, 'lmodty, 'pty) module_ ]
530616 (** @canonical Odoc_model.Paths.Fragment.Resolved.t *)
531617end =
532618 Resolved_fragment
···619705 type hierarchy = tag_hierarchy * string list
620706 (** @canonical Odoc_model.Paths.Reference.Hierarchy.t *)
621707622622- type signature =
623623- [ `Resolved of Resolved_reference.signature
708708+ type ('lmod, 'lmodty, 'pty) signature =
709709+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.signature
624710 | `Root of string * tag_signature
625625- | `Dot of label_parent * string
711711+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
626712 | `Module_path of hierarchy
627627- | `Module of signature * ModuleName.t
628628- | `ModuleType of signature * ModuleTypeName.t ]
713713+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
714714+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t ]
629715 (** @canonical Odoc_model.Paths.Reference.Signature.t *)
630716631631- and class_signature =
632632- [ `Resolved of Resolved_reference.class_signature
717717+ and ('lmod, 'lmodty, 'pty) class_signature =
718718+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.class_signature
633719 | `Root of string * tag_class_signature
634634- | `Dot of label_parent * string
635635- | `Class of signature * TypeName.t
636636- | `ClassType of signature * TypeName.t ]
720720+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
721721+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
722722+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
637723 (** @canonical Odoc_model.Paths.Reference.ClassSignature.t *)
638724639639- and datatype =
640640- [ `Resolved of Resolved_reference.datatype
725725+ and ('lmod, 'lmodty, 'pty) datatype =
726726+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.datatype
641727 | `Root of string * tag_datatype
642642- | `Dot of label_parent * string
643643- | `Type of signature * TypeName.t ]
728728+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
729729+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
644730 (** @canonical Odoc_model.Paths.Reference.DataType.t *)
645731646732 (* Parent of fields and constructor. Can be either a type or [signature] *)
647647- and fragment_type_parent =
648648- [ `Resolved of Resolved_reference.field_parent
733733+ and ('lmod, 'lmodty, 'pty) fragment_type_parent =
734734+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.field_parent
649735 | `Root of string * tag_parent
650650- | `Dot of label_parent * string
736736+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
651737 | `Module_path of hierarchy
652652- | `Module of signature * ModuleName.t
653653- | `ModuleType of signature * ModuleTypeName.t
654654- | `Type of signature * TypeName.t ]
738738+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
739739+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
740740+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
655741 (** @canonical Odoc_model.Paths.Reference.FragmentTypeParent.t *)
656742657657- and label_parent =
658658- [ `Resolved of Resolved_reference.label_parent
743743+ and ('lmod, 'lmodty, 'pty) label_parent =
744744+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.label_parent
659745 | `Root of string * tag_label_parent
660660- | `Dot of label_parent * string
746746+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
661747 | `Page_path of hierarchy
662748 | `Module_path of hierarchy
663749 | `Any_path of hierarchy
664664- | `Module of signature * ModuleName.t
665665- | `ModuleType of signature * ModuleTypeName.t
666666- | `Class of signature * TypeName.t
667667- | `ClassType of signature * TypeName.t
668668- | `Type of signature * TypeName.t ]
750750+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
751751+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
752752+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
753753+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t
754754+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
669755 (** @canonical Odoc_model.Paths.Reference.LabelParent.t *)
670756671757 type asset =
672758 [ `Resolved of Resolved_reference.asset | `Asset_path of hierarchy ]
673759674674- type module_ =
675675- [ `Resolved of Resolved_reference.module_
760760+ type ('lmod, 'lmodty, 'pty) module_ =
761761+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.module_
676762 | `Root of string * [ `TModule | `TUnknown ]
677677- | `Dot of label_parent * string
763763+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
678764 | `Module_path of hierarchy
679679- | `Module of signature * ModuleName.t ]
765765+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t ]
680766 (** @canonical Odoc_model.Paths.Reference.Module.t *)
681767682682- type module_type =
683683- [ `Resolved of Resolved_reference.module_type
768768+ type ('lmod, 'lmodty, 'pty) module_type =
769769+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.module_type
684770 | `Root of string * [ `TModuleType | `TUnknown ]
685685- | `Dot of label_parent * string
686686- | `ModuleType of signature * ModuleTypeName.t ]
771771+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
772772+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t ]
687773 (** @canonical Odoc_model.Paths.Reference.ModuleType.t *)
688774689689- type type_ =
690690- [ `Resolved of Resolved_reference.type_
775775+ type ('lmod, 'lmodty, 'pty) type_ =
776776+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.type_
691777 | `Root of string * [ `TType | `TClass | `TClassType | `TUnknown ]
692692- | `Dot of label_parent * string
693693- | `Class of signature * TypeName.t
694694- | `ClassType of signature * TypeName.t
695695- | `Type of signature * TypeName.t ]
778778+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
779779+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
780780+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t
781781+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
696782 (** @canonical Odoc_model.Paths.Reference.Type.t *)
697783698698- type constructor =
699699- [ `Resolved of Resolved_reference.constructor
784784+ type ('lmod, 'lmodty, 'pty) constructor =
785785+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.constructor
700786 | `Root of string * [ `TConstructor | `TExtension | `TException | `TUnknown ]
701701- | `Dot of label_parent * string
702702- | `Constructor of fragment_type_parent * ConstructorName.t
703703- | `Extension of signature * ExtensionName.t
704704- | `Exception of signature * ExceptionName.t ]
787787+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
788788+ | `Constructor of
789789+ ('lmod, 'lmodty, 'pty) fragment_type_parent * ConstructorName.t
790790+ | `Extension of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
791791+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t ]
705792 (** @canonical Odoc_model.Paths.Reference.Constructor.t *)
706793707707- type field =
708708- [ `Resolved of Resolved_reference.field
794794+ type ('lmod, 'lmodty, 'pty) field =
795795+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.field
709796 | `Root of string * [ `TField | `TUnknown ]
710710- | `Dot of label_parent * string
711711- | `Field of fragment_type_parent * FieldName.t ]
797797+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
798798+ | `Field of ('lmod, 'lmodty, 'pty) fragment_type_parent * FieldName.t ]
712799 (** @canonical Odoc_model.Paths.Reference.Field.t *)
713800714714- type unboxed_field =
715715- [ `Resolved of Resolved_reference.unboxed_field
801801+ type ('lmod, 'lmodty, 'pty) unboxed_field =
802802+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.unboxed_field
716803 | `Root of string * [ `TField | `TUnknown ]
717717- | `Dot of label_parent * string
718718- | `UnboxedField of fragment_type_parent * UnboxedFieldName.t ]
804804+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
805805+ | `UnboxedField of ('lmod, 'lmodty, 'pty) fragment_type_parent * UnboxedFieldName.t ]
719806 (** @canonical Odoc_model.Paths.Reference.UnboxedField.t *)
720807721721- type extension =
722722- [ `Resolved of Resolved_reference.extension
808808+ type ('lmod, 'lmodty, 'pty) extension =
809809+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.extension
723810 | `Root of string * [ `TExtension | `TException | `TUnknown ]
724724- | `Dot of label_parent * string
725725- | `Extension of signature * ExtensionName.t
726726- | `Exception of signature * ExceptionName.t ]
811811+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
812812+ | `Extension of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
813813+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t ]
727814 (** @canonical Odoc_model.Paths.Reference.Extension.t *)
728815729729- type extension_decl =
730730- [ `Resolved of Resolved_reference.extension_decl
816816+ type ('lmod, 'lmodty, 'pty) extension_decl =
817817+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.extension_decl
731818 | `Root of string * [ `TExtension | `TException | `TUnknown ]
732732- | `Dot of label_parent * string
733733- | `ExtensionDecl of signature * ExtensionName.t ]
819819+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
820820+ | `ExtensionDecl of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t ]
734821 (** @canonical Odoc_model.Paths.Reference.ExtensionDecl.t *)
735822736736- type exception_ =
737737- [ `Resolved of Resolved_reference.exception_
823823+ type ('lmod, 'lmodty, 'pty) exception_ =
824824+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.exception_
738825 | `Root of string * [ `TException | `TUnknown ]
739739- | `Dot of label_parent * string
740740- | `Exception of signature * ExceptionName.t ]
826826+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
827827+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t ]
741828 (** @canonical Odoc_model.Paths.Reference.Exception.t *)
742829743743- type value =
744744- [ `Resolved of Resolved_reference.value
830830+ type ('lmod, 'lmodty, 'pty) value =
831831+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.value
745832 | `Root of string * [ `TValue | `TUnknown ]
746746- | `Dot of label_parent * string
747747- | `Value of signature * ValueName.t ]
833833+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
834834+ | `Value of ('lmod, 'lmodty, 'pty) signature * ValueName.t ]
748835 (** @canonical Odoc_model.Paths.Reference.Value.t *)
749836750750- type class_ =
751751- [ `Resolved of Resolved_reference.class_
837837+ type ('lmod, 'lmodty, 'pty) class_ =
838838+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.class_
752839 | `Root of string * [ `TClass | `TUnknown ]
753753- | `Dot of label_parent * string
754754- | `Class of signature * TypeName.t ]
840840+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
841841+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
755842 (** @canonical Odoc_model.Paths.Reference.Class.t *)
756843757757- type class_type =
758758- [ `Resolved of Resolved_reference.class_type
844844+ type ('lmod, 'lmodty, 'pty) class_type =
845845+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.class_type
759846 | `Root of string * [ `TClass | `TClassType | `TUnknown ]
760760- | `Dot of label_parent * string
761761- | `Class of signature * TypeName.t
762762- | `ClassType of signature * TypeName.t ]
847847+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
848848+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
849849+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
763850 (** @canonical Odoc_model.Paths.Reference.ClassType.t *)
764851765765- type method_ =
766766- [ `Resolved of Resolved_reference.method_
852852+ type ('lmod, 'lmodty, 'pty) method_ =
853853+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.method_
767854 | `Root of string * [ `TMethod | `TUnknown ]
768768- | `Dot of label_parent * string
769769- | `Method of class_signature * MethodName.t ]
855855+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
856856+ | `Method of ('lmod, 'lmodty, 'pty) class_signature * MethodName.t ]
770857 (** @canonical Odoc_model.Paths.Reference.Method.t *)
771858772772- type instance_variable =
773773- [ `Resolved of Resolved_reference.instance_variable
859859+ type ('lmod, 'lmodty, 'pty) instance_variable =
860860+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.instance_variable
774861 | `Root of string * [ `TInstanceVariable | `TUnknown ]
775775- | `Dot of label_parent * string
776776- | `InstanceVariable of class_signature * InstanceVariableName.t ]
862862+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
863863+ | `InstanceVariable of
864864+ ('lmod, 'lmodty, 'pty) class_signature * InstanceVariableName.t ]
777865 (** @canonical Odoc_model.Paths.Reference.InstanceVariable.t *)
778866779779- type label =
780780- [ `Resolved of Resolved_reference.label
867867+ type ('lmod, 'lmodty, 'pty) label =
868868+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.label
781869 | `Root of string * [ `TLabel | `TUnknown ]
782782- | `Dot of label_parent * string
783783- | `Label of label_parent * LabelName.t ]
870870+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
871871+ | `Label of ('lmod, 'lmodty, 'pty) label_parent * LabelName.t ]
784872 (** @canonical Odoc_model.Paths.Reference.Label.t *)
785873786786- type page =
874874+ type ('lmod, 'lmodty, 'pty) page =
787875 [ `Resolved of Resolved_reference.page
788876 | `Root of string * [ `TPage | `TUnknown ]
789789- | `Page_path of hierarchy ]
877877+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string ]
790878 (** @canonical Odoc_model.Paths.Reference.Page.t *)
791879792792- type any =
793793- [ `Resolved of Resolved_reference.any
880880+ type ('lmod, 'lmodty, 'pty) any =
881881+ [ `Resolved of ('lmod, 'lmodty, 'pty) Resolved_reference.any
794882 | `Root of string * tag_any
795795- | `Dot of label_parent * string
883883+ | `Dot of ('lmod, 'lmodty, 'pty) label_parent * string
796884 | `Page_path of hierarchy
797885 | `Module_path of hierarchy
798886 | `Asset_path of hierarchy
799887 | `Any_path of hierarchy
800800- | `Module of signature * ModuleName.t
801801- | `ModuleType of signature * ModuleTypeName.t
802802- | `Type of signature * TypeName.t
803803- | `Constructor of fragment_type_parent * ConstructorName.t
804804- | `Field of fragment_type_parent * FieldName.t
805805- | `UnboxedField of fragment_type_parent * UnboxedFieldName.t
806806- | `Extension of signature * ExtensionName.t
807807- | `ExtensionDecl of signature * ExtensionName.t
808808- | `Exception of signature * ExceptionName.t
809809- | `Value of signature * ValueName.t
810810- | `Class of signature * TypeName.t
811811- | `ClassType of signature * TypeName.t
812812- | `Method of class_signature * MethodName.t
813813- | `InstanceVariable of class_signature * InstanceVariableName.t
814814- | `Label of label_parent * LabelName.t ]
888888+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
889889+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
890890+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t
891891+ | `Constructor of
892892+ ('lmod, 'lmodty, 'pty) fragment_type_parent * ConstructorName.t
893893+ | `Field of ('lmod, 'lmodty, 'pty) fragment_type_parent * FieldName.t
894894+ | `UnboxedField of ('lmod, 'lmodty, 'pty) fragment_type_parent * UnboxedFieldName.t
895895+ | `Extension of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
896896+ | `ExtensionDecl of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
897897+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t
898898+ | `Value of ('lmod, 'lmodty, 'pty) signature * ValueName.t
899899+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
900900+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t
901901+ | `Method of ('lmod, 'lmodty, 'pty) class_signature * MethodName.t
902902+ | `InstanceVariable of
903903+ ('lmod, 'lmodty, 'pty) class_signature * InstanceVariableName.t
904904+ | `Label of ('lmod, 'lmodty, 'pty) label_parent * LabelName.t ]
815905 (** @canonical Odoc_model.Paths.Reference.t *)
816906end =
817907 Reference
···823913 we define here all those types that ever appear on the right hand
824914 side of the constructors and then below we redefine many with
825915 the actual hierarchy made more explicit. *)
826826- type datatype =
827827- [ `Identifier of Identifier.datatype | `Type of signature * TypeName.t ]
916916+ type ('lmod, 'lmodty, 'pty) datatype =
917917+ [ `Identifier of Identifier.datatype
918918+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
828919 (** @canonical Odoc_model.Paths.Reference.Resolved.DataType.t *)
829920830830- and module_ =
921921+ and ('lmod, 'lmodty, 'pty) module_ =
831922 [ `Identifier of Identifier.path_module
832832- | `Hidden of module_
833833- | `Alias of Resolved_path.module_ * module_
834834- | `Module of signature * ModuleName.t ]
923923+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
924924+ | `Alias of
925925+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
926926+ * ('lmod, 'lmodty, 'pty) module_
927927+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t ]
835928 (** @canonical Odoc_model.Paths.Reference.Resolved.Module.t *)
836929837930 (* Signature is [ module | moduletype ] *)
838838- and signature =
931931+ and ('lmod, 'lmodty, 'pty) signature =
839932 [ `Identifier of Identifier.signature
840840- | `Hidden of module_
841841- | `Alias of Resolved_path.module_ * module_
842842- | `Module of signature * ModuleName.t
843843- | `ModuleType of signature * ModuleTypeName.t
844844- | `AliasModuleType of Resolved_path.module_type * module_type ]
933933+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
934934+ | `Alias of
935935+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
936936+ * ('lmod, 'lmodty, 'pty) module_
937937+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
938938+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
939939+ | `AliasModuleType of
940940+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
941941+ * ('lmod, 'lmodty, 'pty) module_type ]
845942 (** @canonical Odoc_model.Paths.Reference.Resolved.Signature.t *)
846943847847- and class_signature =
944944+ and ('lmod, 'lmodty, 'pty) class_signature =
848945 [ `Identifier of Identifier.class_signature
849849- | `Class of signature * TypeName.t
850850- | `ClassType of signature * TypeName.t ]
946946+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
947947+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
851948 (** @canonical Odoc_model.Paths.Reference.Resolved.ClassSignature.t *)
852949853950 (* fragment_type_parent in resolved references is for record fields parent.
854854- It’s type (for usual record fields) or [signature] for fields of inline
951951+ It's type (for usual record fields) or [signature] for fields of inline
855952 records of extension constructor. *)
856856- and field_parent =
953953+ and ('lmod, 'lmodty, 'pty) field_parent =
857954 [ `Identifier of Identifier.field_parent
858858- | `Alias of Resolved_path.module_ * module_
859859- | `AliasModuleType of Resolved_path.module_type * module_type
860860- | `Module of signature * ModuleName.t
861861- | `Hidden of module_
862862- | `ModuleType of signature * ModuleTypeName.t
863863- | `Type of signature * TypeName.t ]
955955+ | `Alias of
956956+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
957957+ * ('lmod, 'lmodty, 'pty) module_
958958+ | `AliasModuleType of
959959+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
960960+ * ('lmod, 'lmodty, 'pty) module_type
961961+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
962962+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
963963+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
964964+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
864965 (** @canonical Odoc_model.Paths.Reference.Resolved.FragmentTypeParent.t *)
865966866866- and unboxed_field_parent =
967967+ and ('lmod, 'lmodty, 'pty) unboxed_field_parent =
867968 [ `Identifier of Identifier.unboxed_field_parent
868868- | `Type of signature * TypeName.t ]
969969+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
869970 (** @canonical Odoc_model.Paths.Reference.Resolved.FragmentTypeParent.t *)
870971871972 (* The only difference between parent and label_parent
872973 is that the Identifier allows more types *)
873873- and label_parent =
974974+ and ('lmod, 'lmodty, 'pty) label_parent =
874975 [ `Identifier of Identifier.label_parent
875875- | `Alias of Resolved_path.module_ * module_
876876- | `AliasModuleType of Resolved_path.module_type * module_type
877877- | `Module of signature * ModuleName.t
878878- | `Hidden of module_
879879- | `ModuleType of signature * ModuleTypeName.t
880880- | `Class of signature * TypeName.t
881881- | `ClassType of signature * TypeName.t
882882- | `Type of signature * TypeName.t ]
976976+ | `Alias of
977977+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
978978+ * ('lmod, 'lmodty, 'pty) module_
979979+ | `AliasModuleType of
980980+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
981981+ * ('lmod, 'lmodty, 'pty) module_type
982982+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
983983+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
984984+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
985985+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
986986+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t
987987+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
883988 (** @canonical Odoc_model.Paths.Reference.Resolved.LabelParent.t *)
884989885885- and module_type =
990990+ and ('lmod, 'lmodty, 'pty) module_type =
886991 [ `Identifier of Identifier.reference_module_type
887887- | `ModuleType of signature * ModuleTypeName.t
888888- | `AliasModuleType of Resolved_path.module_type * module_type ]
992992+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
993993+ | `AliasModuleType of
994994+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
995995+ * ('lmod, 'lmodty, 'pty) module_type ]
889996 (** @canonical Odoc_model.Paths.Reference.Resolved.ModuleType.t *)
890997891891- type type_ =
998998+ type ('lmod, 'lmodty, 'pty) type_ =
892999 [ `Identifier of Identifier.reference_type
893893- | `Type of signature * TypeName.t
894894- | `Class of signature * TypeName.t
895895- | `ClassType of signature * TypeName.t ]
10001000+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t
10011001+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
10021002+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
8961003 (** @canonical Odoc_model.Paths.Reference.Resolved.Type.t *)
8971004898898- type constructor =
10051005+ type ('lmod, 'lmodty, 'pty) constructor =
8991006 [ `Identifier of Identifier.reference_constructor
900900- | `Constructor of datatype * ConstructorName.t
901901- | `Extension of signature * ExtensionName.t
902902- | `Exception of signature * ExceptionName.t ]
10071007+ | `Constructor of ('lmod, 'lmodty, 'pty) datatype * ConstructorName.t
10081008+ | `Extension of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
10091009+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t ]
9031010 (** @canonical Odoc_model.Paths.Reference.Resolved.Constructor.t *)
9041011905905- type field =
10121012+ type ('lmod, 'lmodty, 'pty) field =
9061013 [ `Identifier of Identifier.reference_field
907907- | `Field of field_parent * FieldName.t ]
10141014+ | `Field of ('lmod, 'lmodty, 'pty) field_parent * FieldName.t ]
9081015 (** @canonical Odoc_model.Paths.Reference.Resolved.Field.t *)
9091016910910- type unboxed_field =
10171017+ type ('lmod, 'lmodty, 'pty) unboxed_field =
9111018 [ `Identifier of Identifier.reference_unboxed_field
912912- | `UnboxedField of unboxed_field_parent * UnboxedFieldName.t ]
10191019+ | `UnboxedField of ('lmod, 'lmodty, 'pty) unboxed_field_parent * UnboxedFieldName.t ]
9131020 (** @canonical Odoc_model.Paths.Reference.Resolved.UnboxedField.t *)
9141021915915- type extension =
10221022+ type ('lmod, 'lmodty, 'pty) extension =
9161023 [ `Identifier of Identifier.reference_extension
917917- | `Extension of signature * ExtensionName.t
918918- | `Exception of signature * ExceptionName.t ]
10241024+ | `Extension of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
10251025+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t ]
9191026 (** @canonical Odoc_model.Paths.Reference.Resolved.Extension.t *)
9201027921921- type extension_decl =
10281028+ type ('lmod, 'lmodty, 'pty) extension_decl =
9221029 [ `Identifier of Identifier.reference_extension_decl
9231030 | `ExtensionDecl of
924924- signature
10311031+ ('lmod, 'lmodty, 'pty) signature
9251032 * ExtensionName.t
9261033 (* The extension_name used in the url.
9271034 It is the extension_name of the first constructor of the extension (there is always at least 1). *)
9281035 * ExtensionName.t (* displayed *) ]
9291036 (** @canonical Odoc_model.Paths.Reference.Resolved.Extension.t *)
9301037931931- type exception_ =
10381038+ type ('lmod, 'lmodty, 'pty) exception_ =
9321039 [ `Identifier of Identifier.reference_exception
933933- | `Exception of signature * ExceptionName.t ]
10401040+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t ]
9341041 (** @canonical Odoc_model.Paths.Reference.Resolved.Exception.t *)
9351042936936- type value =
10431043+ type ('lmod, 'lmodty, 'pty) value =
9371044 [ `Identifier of Identifier.reference_value
938938- | `Value of signature * ValueName.t ]
10451045+ | `Value of ('lmod, 'lmodty, 'pty) signature * ValueName.t ]
9391046 (** @canonical Odoc_model.Paths.Reference.Resolved.Value.t *)
9401047941941- type class_ =
10481048+ type ('lmod, 'lmodty, 'pty) class_ =
9421049 [ `Identifier of Identifier.reference_class
943943- | `Class of signature * TypeName.t ]
10501050+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
9441051 (** @canonical Odoc_model.Paths.Reference.Resolved.Class.t *)
9451052946946- type class_type =
10531053+ type ('lmod, 'lmodty, 'pty) class_type =
9471054 [ `Identifier of Identifier.reference_class_type
948948- | `Class of signature * TypeName.t
949949- | `ClassType of signature * TypeName.t ]
10551055+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
10561056+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t ]
9501057 (** @canonical Odoc_model.Paths.Reference.Resolved.ClassType.t *)
9511058952952- type method_ =
10591059+ type ('lmod, 'lmodty, 'pty) method_ =
9531060 [ `Identifier of Identifier.reference_method
954954- | `Method of class_signature * MethodName.t ]
10611061+ | `Method of ('lmod, 'lmodty, 'pty) class_signature * MethodName.t ]
9551062 (** @canonical Odoc_model.Paths.Reference.Resolved.Method.t *)
9561063957957- type instance_variable =
10641064+ type ('lmod, 'lmodty, 'pty) instance_variable =
9581065 [ `Identifier of Identifier.reference_instance_variable
959959- | `InstanceVariable of class_signature * InstanceVariableName.t ]
10661066+ | `InstanceVariable of
10671067+ ('lmod, 'lmodty, 'pty) class_signature * InstanceVariableName.t ]
9601068 (** @canonical Odoc_model.Paths.Reference.Resolved.InstanceVariable.t *)
9611069962962- type label =
10701070+ type ('lmod, 'lmodty, 'pty) label =
9631071 [ `Identifier of Identifier.reference_label
964964- | `Label of label_parent * LabelName.t ]
10721072+ | `Label of ('lmod, 'lmodty, 'pty) label_parent * LabelName.t ]
9651073 (** @canonical Odoc_model.Paths.Reference.Resolved.Label.t *)
96610749671075 type page = [ `Identifier of Identifier.reference_page ]
···9701078 type asset = [ `Identifier of Identifier.asset_file ]
9711079 (** @canonical Odoc_model.Paths.Reference.Resolved.Asset.t *)
9721080973973- type any =
10811081+ type ('lmod, 'lmodty, 'pty) any =
9741082 [ `Identifier of Identifier.any
975975- | `Alias of Resolved_path.module_ * module_
976976- | `AliasModuleType of Resolved_path.module_type * module_type
977977- | `Module of signature * ModuleName.t
978978- | `Hidden of module_
979979- | `ModuleType of signature * ModuleTypeName.t
980980- | `Type of signature * TypeName.t
981981- | `Constructor of datatype * ConstructorName.t
982982- | `PolyConstructor of datatype * ConstructorName.t
983983- | `Field of field_parent * FieldName.t
984984- | `UnboxedField of unboxed_field_parent * UnboxedFieldName.t
985985- | `Extension of signature * ExtensionName.t
986986- | `ExtensionDecl of signature * ExtensionName.t * ExtensionName.t
987987- | `Exception of signature * ExceptionName.t
988988- | `Value of signature * ValueName.t
989989- | `Class of signature * TypeName.t
990990- | `ClassType of signature * TypeName.t
991991- | `Method of class_signature * MethodName.t
992992- | `InstanceVariable of class_signature * InstanceVariableName.t
993993- | `Label of label_parent * LabelName.t ]
10831083+ | `Alias of
10841084+ ('lmod, 'lmodty, 'pty) Resolved_path.module_
10851085+ * ('lmod, 'lmodty, 'pty) module_
10861086+ | `AliasModuleType of
10871087+ ('lmod, 'lmodty, 'pty) Resolved_path.module_type
10881088+ * ('lmod, 'lmodty, 'pty) module_type
10891089+ | `Module of ('lmod, 'lmodty, 'pty) signature * ModuleName.t
10901090+ | `Hidden of ('lmod, 'lmodty, 'pty) module_
10911091+ | `ModuleType of ('lmod, 'lmodty, 'pty) signature * ModuleTypeName.t
10921092+ | `Type of ('lmod, 'lmodty, 'pty) signature * TypeName.t
10931093+ | `Constructor of ('lmod, 'lmodty, 'pty) datatype * ConstructorName.t
10941094+ | `PolyConstructor of ('lmod, 'lmodty, 'pty) datatype * ConstructorName.t
10951095+ | `Field of ('lmod, 'lmodty, 'pty) field_parent * FieldName.t
10961096+ | `UnboxedField of ('lmod, 'lmodty, 'pty) unboxed_field_parent * UnboxedFieldName.t
10971097+ | `Extension of ('lmod, 'lmodty, 'pty) signature * ExtensionName.t
10981098+ | `ExtensionDecl of
10991099+ ('lmod, 'lmodty, 'pty) signature * ExtensionName.t * ExtensionName.t
11001100+ | `Exception of ('lmod, 'lmodty, 'pty) signature * ExceptionName.t
11011101+ | `Value of ('lmod, 'lmodty, 'pty) signature * ValueName.t
11021102+ | `Class of ('lmod, 'lmodty, 'pty) signature * TypeName.t
11031103+ | `ClassType of ('lmod, 'lmodty, 'pty) signature * TypeName.t
11041104+ | `Method of ('lmod, 'lmodty, 'pty) class_signature * MethodName.t
11051105+ | `InstanceVariable of
11061106+ ('lmod, 'lmodty, 'pty) class_signature * InstanceVariableName.t
11071107+ | `Label of ('lmod, 'lmodty, 'pty) label_parent * LabelName.t ]
9941108 (** @canonical Odoc_model.Paths.Reference.Resolved.t *)
9951109end =
9961110 Resolved_reference
···44 let incr tbl p =
55 let open Odoc_model.Paths.Path.Resolved in
66 let p = (p :> t) in
77- let id = identifier p in
88- match id with
99- | Some id when (not (is_hidden p)) || include_hidden -> Table.add tbl id
1010- | _ -> ()
77+ match identifier p with
88+ | Some id ->
99+ if (not (is_hidden p)) || include_hidden then Table.add tbl id
1010+ | None -> ()
1111 in
1212 let open Odoc_model.Lang in
1313 List.iter
+69
odoc/src/odoc/bin/main.ml
···99open Odoc_odoc
1010open Cmdliner
11111212+(* Statmemprof-based allocation profiling.
1313+ Enable with ODOC_STATMEMPROF=<rate> e.g. ODOC_STATMEMPROF=0.001 *)
1414+let () =
1515+ match Sys.getenv_opt "ODOC_STATMEMPROF" with
1616+ | None -> ()
1717+ | Some rate_str ->
1818+ let rate = float_of_string rate_str in
1919+ let sites : (string, int ref) Hashtbl.t = Hashtbl.create 1024 in
2020+ let total = ref 0 in
2121+ let frame_of_slot slot =
2222+ match Printexc.Slot.location slot with
2323+ | Some l ->
2424+ Printf.sprintf "%s:%d" l.Printexc.filename l.Printexc.line_number
2525+ | None -> "?"
2626+ in
2727+ let key_of_callstack cs =
2828+ let slots = Printexc.backtrace_slots cs in
2929+ match slots with
3030+ | None -> "<no backtrace>"
3131+ | Some arr ->
3232+ let n = min 12 (Array.length arr) in
3333+ let parts = Array.sub arr 0 n in
3434+ Stdlib.String.concat " <- " (Array.to_list (Array.map frame_of_slot parts))
3535+ in
3636+ let tracker : (unit, unit) Gc.Memprof.tracker = {
3737+ alloc_minor = (fun info ->
3838+ let words = info.size in
3939+ total := !total + words;
4040+ let key = key_of_callstack info.callstack in
4141+ (match Hashtbl.find_opt sites key with
4242+ | Some r -> r := !r + words
4343+ | None -> Hashtbl.add sites key (ref words));
4444+ None);
4545+ alloc_major = (fun info ->
4646+ let words = info.size in
4747+ total := !total + words;
4848+ let key = key_of_callstack info.callstack in
4949+ (match Hashtbl.find_opt sites key with
5050+ | Some r -> r := !r + words
5151+ | None -> Hashtbl.add sites key (ref words));
5252+ None);
5353+ promote = (fun () -> None);
5454+ dealloc_minor = (fun () -> ());
5555+ dealloc_major = (fun () -> ());
5656+ } in
5757+ let _profile =
5858+ Gc.Memprof.start ~sampling_rate:rate ~callstack_size:20 tracker
5959+ in
6060+ at_exit (fun () ->
6161+ Gc.Memprof.stop ();
6262+ let entries =
6363+ Hashtbl.fold (fun k v acc -> (k, !v) :: acc) sites []
6464+ in
6565+ let sorted =
6666+ List.sort ~cmp:(fun (_, a) (_, b) -> compare b a) entries
6767+ in
6868+ Printf.eprintf "\n=== Statmemprof results (sampling rate %g) ===\n" rate;
6969+ Printf.eprintf "Total sampled words: %d (%.0f MB est.)\n"
7070+ !total
7171+ (float_of_int !total *. 8.0 /. 1048576.0 /. rate);
7272+ Printf.eprintf "\nTop 40 allocation sites:\n";
7373+ Printf.eprintf "%-120s %10s %6s\n" "Backtrace" "MB est" "%";
7474+ Printf.eprintf "%s\n" (Stdlib.String.make 140 '-');
7575+ let top = List.filteri ~f:(fun i _ -> i < 40) sorted in
7676+ List.iter top ~f:(fun (site, words) ->
7777+ let mb = float_of_int words *. 8.0 /. 1048576.0 /. rate in
7878+ let pct = 100.0 *. float_of_int words /. float_of_int (max 1 !total) in
7979+ Printf.eprintf "%-120s %10.1f %5.1f%%\n" site mb pct))
8080+1281(* Load all installed extensions at startup *)
1382let () = Sites.Plugins.Extensions.load_all ()
1483
+12-10
odoc/src/odoc/url.ml
···2929 in
3030 Error (`Msg error)
3131 | Ok (resolved_reference, _) -> (
3232- match
3232+ let identifier =
3333 Odoc_model.Paths.Reference.Resolved.identifier resolved_reference
3434- with
3434+ in
3535+ match identifier with
3636+ | None ->
3737+ Error (`Msg "Could not resolve identifier")
3538 | Some identifier ->
3636- (* We have a valid identifier, we can create the URL *)
3737- let url =
3838- Odoc_document.Url.from_identifier ~stop_before:false identifier
3939- in
4040- let href = url_to_string url in
4141- print_endline href;
4242- Ok ()
4343- | None -> Error (`Msg "Hidden reference")))
3939+ (* We have a valid identifier, we can create the URL *)
4040+ let url =
4141+ Odoc_document.Url.from_identifier ~stop_before:false identifier
4242+ in
4343+ let href = url_to_string url in
4444+ print_endline href;
4545+ Ok ()))
44464547let reference_to_url_html { Html_page.html_config = config; _ } root_url =
4648 let url_to_string url =
+325-141
odoc/src/xref2/component.ml
···678678 fun c ppf i ->
679679 if c.short_paths then Ident.short_fmt ppf i else Ident.fmt ppf i
680680681681+ let local_mod_fmt c ppf (id : Cpath.lmod) =
682682+ match id with `Na _ -> . | #Ident.module_ as i -> ident_fmt c ppf i
683683+684684+ let local_modty_fmt c ppf (id : Cpath.lmodty) =
685685+ match id with `Na _ -> . | #Ident.module_type as i -> ident_fmt c ppf i
686686+687687+ let local_ty_fmt c ppf (id : Cpath.lty) =
688688+ match id with `Na _ -> . | #Ident.type_ as i -> ident_fmt c ppf i
689689+690690+ let local_val_fmt c ppf (id : Cpath.lval) =
691691+ match id with `Na _ -> . | #Ident.value as i -> ident_fmt c ppf i
692692+681693 let rec model_identifier c ppf (p : id) =
682694 match p.iv with
683695 | `Root (_, unit_name) ->
···12241236 config -> Format.formatter -> Cpath.Resolved.module_ -> unit =
12251237 fun c ppf p ->
12261238 match p with
12271227- | `Local ident -> ident_fmt c ppf ident
12391239+ | `LocalMod ident -> local_mod_fmt c ppf ident
12281240 | `Apply (p1, p2) ->
12291241 Format.fprintf ppf "%a(%a)" (resolved_module_path c) p1
12301242 (resolved_module_path c) p2
12311231- | `Gpath p -> Format.fprintf ppf "%a" (model_resolved_path c) (p :> rpath)
12431243+ | `Identifier p -> model_identifier c ppf (p :> id)
12321244 | `Substituted p -> wrap c "substituted" resolved_module_path ppf p
12331245 | `Module (p, m) ->
12341246 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
···12401252 p2
12411253 | `Hidden p1 -> wrap c "hidden" resolved_module_path ppf p1
12421254 | `Canonical (p1, p2) ->
12431243- wrap2 c "canonical" resolved_module_path model_path ppf p1 (p2 :> path)
12551255+ wrap2 c "canonical" resolved_module_path module_path ppf p1 p2
12441256 | `OpaqueModule m -> wrap c "opaquemodule" resolved_module_path ppf m
1245125712461258 and module_path : config -> Format.formatter -> Cpath.module_ -> unit =
···12491261 | `Resolved p -> wrap c "resolved" resolved_module_path ppf p
12501262 | `Dot (p, n) ->
12511263 Format.fprintf ppf "%a.%a" (module_path c) p ModuleName.fmt n
12521252- | `Module (p, n) ->
12641264+ | `Module (_, p, n) ->
12531265 Format.fprintf ppf "%a.%a" (resolved_parent_path c) p ModuleName.fmt n
12541266 | `Apply (p1, p2) ->
12551267 Format.fprintf ppf "%a(%a)" (module_path c) p1 (module_path c) p2
12561268 | `Identifier (id, b) ->
12571269 wrap2 c "identifier" model_identifier bool ppf (id :> id) b
12581258- | `Local (id, b) -> wrap2 c "local" ident_fmt bool ppf id b
12701270+ | `LocalMod id -> wrap c "local" local_mod_fmt ppf id
12591271 | `Substituted p -> wrap c "substituted" module_path ppf p
12601272 | `Forward s -> wrap c "forward" str ppf s
12611273 | `Root r -> wrap c "unresolvedroot" str ppf (ModuleName.to_string r)
···12641276 config -> Format.formatter -> Cpath.Resolved.module_type -> unit =
12651277 fun c ppf p ->
12661278 match p with
12671267- | `Local id -> ident_fmt c ppf id
12681268- | `Gpath p -> model_resolved_path c ppf (p :> rpath)
12691269- | `Substituted x -> wrap c "substituted" resolved_module_type_path ppf x
12791279+ | `LocalModTy id -> local_modty_fmt c ppf id
12801280+ | `Identifier p -> model_identifier c ppf (p :> id)
12811281+ | `SubstitutedMT x -> wrap c "substituted" resolved_module_type_path ppf x
12701282 | `ModuleType (p, m) ->
12711283 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
12721284 (ModuleTypeName.to_string m)
12731285 | `CanonicalModuleType (m1, m2) ->
12741274- wrap2 c "canonicalt" resolved_module_type_path model_path ppf m1
12751275- (m2 :> path)
12861286+ wrap2 c "canonicalt" resolved_module_type_path module_type_path ppf m1
12871287+ m2
12761288 | `OpaqueModuleType m ->
12771289 wrap c "opaquemoduletype" resolved_module_type_path ppf m
12781290 | `AliasModuleType (mt1, mt2) ->
···12891301 | `Resolved p -> wrap c "r" resolved_module_type_path ppf p
12901302 | `Identifier (id, b) ->
12911303 wrap2 c "identifier" model_identifier bool ppf (id :> id) b
12921292- | `Local (id, b) -> wrap2 c "local" ident_fmt bool ppf id b
12931293- | `Substituted s -> wrap c "substituted" module_type_path ppf s
13041304+ | `LocalModTy id -> wrap c "local" local_modty_fmt ppf id
13051305+ | `SubstitutedMT s -> wrap c "substituted" module_type_path ppf s
12941306 | `DotMT (m, s) ->
12951307 Format.fprintf ppf "%a.%a" (module_path c) m ModuleTypeName.fmt s
12961296- | `ModuleType (m, n) ->
13081308+ | `ModuleType (_, m, n) ->
12971309 Format.fprintf ppf "%a.%a" (resolved_parent_path c) m ModuleTypeName.fmt
12981310 n
12991311···13021314 fun c ppf p ->
13031315 match p with
13041316 | `CoreType n -> Format.fprintf ppf "%s" (TypeName.to_string n)
13051305- | `Local id -> ident_fmt c ppf id
13061306- | `Gpath p -> model_resolved_path c ppf (p :> rpath)
13071307- | `Substituted x -> wrap c "substituted" resolved_type_path ppf x
13171317+ | `LocalTy id -> local_ty_fmt c ppf id
13181318+ | `Identifier p -> model_identifier c ppf (p :> id)
13191319+ | `SubstitutedT x -> wrap c "substituted" resolved_type_path ppf x
13201320+ | `SubstitutedCT x -> wrap c "substituted" resolved_type_path ppf (x :> Cpath.Resolved.type_)
13081321 | `CanonicalType (t1, t2) ->
13091309- wrap2 c "canonicaltype" resolved_type_path model_path ppf t1
13101310- (t2 :> path)
13221322+ wrap2 c "canonicaltype" resolved_type_path type_path ppf t1
13231323+ t2
13111324 | `Class (p, t) ->
13121325 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13131326 (TypeName.to_string t)
···13251338 | `Value (p, t) ->
13261339 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13271340 (ValueName.to_string t)
13281328- | `Gpath p -> Format.fprintf ppf "%a" (model_resolved_path c) (p :> rpath)
13411341+ | `Identifier p -> model_identifier c ppf (p :> id)
13421342+ | `LocalVal id -> local_val_fmt c ppf id
1329134313301344 and resolved_parent_path :
13311345 config -> Format.formatter -> Cpath.Resolved.parent -> unit =
13321346 fun c ppf p ->
13331347 match p with
13341348 | `Module m -> resolved_module_path c ppf m
13351335- | `ModuleType m ->
13491349+ | `ModuleType (m, `U) ->
13361350 if c.short_paths then resolved_module_type_path c ppf m
13371351 else Format.fprintf ppf ">>%a<<" (resolved_module_type_path c) m
13381338- | `FragmentRoot -> Format.fprintf ppf "FragmentRoot"
13521352+ | `FragmentRoot `U -> Format.fprintf ppf "FragmentRoot"
13531353+ | `ModuleType (_, `Na _) -> .
13541354+ | `FragmentRoot (`Na _) -> .
1339135513401356 and type_path : config -> Format.formatter -> Cpath.type_ -> unit =
13411357 fun c ppf p ->
···13431359 | `Resolved r -> wrap c "resolved" resolved_type_path ppf r
13441360 | `Identifier (id, b) ->
13451361 wrap2 c "identifier" model_identifier bool ppf (id :> id) b
13461346- | `Local (id, b) -> wrap2 c "local" ident_fmt bool ppf id b
13471347- | `Substituted s -> wrap c "substituted" type_path ppf s
13621362+ | `LocalTy id -> wrap c "local" local_ty_fmt ppf id
13631363+ | `SubstitutedT s -> wrap c "substituted" type_path ppf s
13641364+ | `SubstitutedCT s -> wrap c "substituted" class_type_path ppf (s :> Cpath.class_type)
13481365 | `DotT (m, s) ->
13491366 Format.fprintf ppf "%a.%a" (module_path c) m TypeName.fmt s
13501350- | `Class (p, t) ->
13511351- Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13521352- (TypeName.to_string t)
13531353- | `ClassType (p, t) ->
13541354- Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13551355- (TypeName.to_string t)
13561356- | `Type (p, t) ->
13671367+ | `Type (_, p, t) ->
13571368 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13581369 (TypeName.to_string t)
13591370···13631374 | `Resolved r -> wrap c "resolved" resolved_value_path ppf r
13641375 | `DotV (m, s) ->
13651376 Format.fprintf ppf "%a.%a" (module_path c) m ValueName.fmt s
13661366- | `Value (p, t) ->
13671367- Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13681368- (ValueName.to_string t)
13771377+ | `LocalVal id -> wrap c "local" local_val_fmt ppf id
13691378 | `Identifier (id, b) ->
13701379 wrap2 c "identifier" model_identifier bool ppf (id :> id) b
13711380···13731382 config -> Format.formatter -> Cpath.Resolved.class_type -> unit =
13741383 fun c ppf p ->
13751384 match p with
13761376- | `Local id -> Format.fprintf ppf "%a" Ident.fmt id
13771377- | `Gpath p -> Format.fprintf ppf "%a" (model_resolved_path c) (p :> rpath)
13781378- | `Substituted s -> wrap c "substituted" resolved_class_type_path ppf s
13851385+ | `LocalTy id -> local_ty_fmt c ppf id
13861386+ | `Identifier p -> model_identifier c ppf (p :> id)
13871387+ | `SubstitutedCT s -> wrap c "substituted" resolved_class_type_path ppf s
13791388 | `Class (p, t) ->
13801389 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13811390 (TypeName.to_string t)
···13891398 | `Resolved r -> Format.fprintf ppf "%a" (resolved_class_type_path c) r
13901399 | `Identifier (id, b) ->
13911400 wrap2 c "identifier" model_identifier bool ppf (id :> id) b
13921392- | `Local (id, b) -> wrap2 c "local" ident_fmt bool ppf id b
13931393- | `Substituted s -> wrap c "substituted" class_type_path ppf s
14011401+ | `LocalTy id -> wrap c "local" local_ty_fmt ppf id
14021402+ | `SubstitutedCT s -> wrap c "substituted" class_type_path ppf s
13941403 | `DotT (m, s) ->
13951404 Format.fprintf ppf "%a.%a" (module_path c) m TypeName.fmt s
13961396- | `Class (p, t) ->
13971397- Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
13981398- (TypeName.to_string t)
13991399- | `ClassType (p, t) ->
14051405+ | `Type (_, p, t) ->
14001406 Format.fprintf ppf "%a.%s" (resolved_parent_path c) p
14011407 (TypeName.to_string t)
14021408···14311437 wrap c "substitutedt" model_path ppf (m :> Odoc_model.Paths.Path.t)
14321438 | `SubstitutedCT m ->
14331439 wrap c "substitutedct" model_path ppf (m :> Odoc_model.Paths.Path.t)
14401440+ | `Module (_, _p, n) ->
14411441+ Format.fprintf ppf "%s" (ModuleName.to_string n)
14421442+ | `ModuleType (_, _p, n) ->
14431443+ Format.fprintf ppf "%s" (ModuleTypeName.to_string n)
14441444+ | `Type (_, _p, n) ->
14451445+ Format.fprintf ppf "%s" (TypeName.to_string n)
14461446+ | `LocalMod (`Na _) -> .
14471447+ | `LocalModTy (`Na _) -> .
14481448+ | `LocalTy (`Na _) -> .
14491449+ | `LocalVal (`Na _) -> .
14501450+14511451+ and model_resolved_parent (c : config) ppf (p : Odoc_model.Paths.Path.Resolved.parent) =
14521452+ match p with
14531453+ | `Module m -> model_resolved_path c ppf (m :> rpath)
14541454+ | `ModuleType (_, `Na _) -> .
14551455+ | `FragmentRoot (`Na _) -> .
1434145614351457 and model_resolved_path (c : config) ppf (p : rpath) =
14361458 let open Odoc_model.Paths.Path.Resolved in
···14381460 | `CoreType x -> Format.fprintf ppf "%s" (TypeName.to_string x)
14391461 | `Identifier id -> Format.fprintf ppf "%a" (model_identifier c) (id :> id)
14401462 | `Module (parent, name) ->
14411441- Format.fprintf ppf "%a.%s" (model_resolved_path c)
14421442- (parent :> t)
14631463+ Format.fprintf ppf "%a.%s" (model_resolved_parent c) parent
14431464 (ModuleName.to_string name)
14441465 | `ModuleType (parent, name) ->
14451445- Format.fprintf ppf "%a.%s" (model_resolved_path c)
14461446- (parent :> t)
14661466+ Format.fprintf ppf "%a.%s" (model_resolved_parent c) parent
14471467 (ModuleTypeName.to_string name)
14481468 | `Type (parent, name) ->
14491449- Format.fprintf ppf "%a.%s" (model_resolved_path c)
14501450- (parent :> t)
14691469+ Format.fprintf ppf "%a.%s" (model_resolved_parent c) parent
14511470 (TypeName.to_string name)
14521471 | `Value (parent, name) ->
14531453- Format.fprintf ppf "%a.%s" (model_resolved_path c)
14541454- (parent :> t)
14721472+ Format.fprintf ppf "%a.%s" (model_resolved_parent c) parent
14551473 (ValueName.to_string name)
14561456- | `Alias (dest, src) ->
14741474+ | `Alias (dest, src, _) ->
14571475 wrap2r c "alias" model_resolved_path model_path ppf
14581476 (dest :> t)
14591477 (src :> path)
···14881506 (p2 :> path)
14891507 | `Hidden p -> wrap c "hidden" model_resolved_path ppf (p :> t)
14901508 | `Class (parent, name) ->
14911491- Format.fprintf ppf "%a.%s" (model_resolved_path c)
14921492- (parent :> t)
15091509+ Format.fprintf ppf "%a.%s" (model_resolved_parent c) parent
14931510 (TypeName.to_string name)
14941511 | `ClassType (parent, name) ->
14951495- Format.fprintf ppf "%a.%s" (model_resolved_path c)
14961496- (parent :> t)
15121512+ Format.fprintf ppf "%a.%s" (model_resolved_parent c) parent
14971513 (TypeName.to_string name)
14981514 | `OpaqueModule m -> wrap c "opaquemodule" model_resolved_path ppf (m :> t)
14991515 | `OpaqueModuleType m ->
···15041520 | `SubstitutedT m -> wrap c "substitutedt" model_resolved_path ppf (m :> t)
15051521 | `SubstitutedCT m ->
15061522 wrap c "substitutedct" model_resolved_path ppf (m :> t)
15231523+ | `LocalMod (`Na _) -> .
15241524+ | `LocalModTy (`Na _) -> .
15251525+ | `LocalTy (`Na _) -> .
15261526+ | `LocalVal (`Na _) -> .
1507152715081528 and model_fragment c ppf (f : Odoc_model.Paths.Fragment.t) =
15091529 match f with
···19781998 let option conv ident_map x =
19791999 match x with None -> None | Some x' -> Some (conv ident_map x')
1980200019811981- let identifier lookup map i =
20012001+ let identifier_mod lookup map i =
20022002+ match lookup i map with
20032003+ | x -> `LocalMod x
20042004+ | exception Not_found -> `Identifier i
20052005+20062006+ let identifier_modty lookup map i =
19822007 match lookup i map with
19831983- | x -> `Local x
20082008+ | x -> `LocalModTy x
20092009+ | exception Not_found -> `Identifier i
20102010+20112011+ let identifier_ty lookup map i =
20122012+ match lookup i map with
20132013+ | x -> `LocalTy x
19842014 | exception Not_found -> `Identifier i
1985201519862016 let find_any_module i ident_map =
···19942024 Maps.FunctorParameter.find id ident_map.functor_parameters
19952025 | _ -> raise Not_found
1996202619971997- let rec resolved_module_path :
20272027+ (* Path conversion with sharing: when no identifier in the path maps to a
20282028+ local ident, the original path is returned (coerced) without allocation.
20292029+ We use physical equality (==) to detect unchanged sub-paths. *)
20302030+20312031+ let rec resolved_parent_path :
20322032+ _ -> Odoc_model.Paths.Path.Resolved.parent -> Cpath.Resolved.parent =
20332033+ fun ident_map p ->
20342034+ match p with
20352035+ | `Module m ->
20362036+ let m' = resolved_module_path ident_map m in
20372037+ if m' == (m :> Cpath.Resolved.module_) then (p :> Cpath.Resolved.parent)
20382038+ else `Module m'
20392039+ | `ModuleType (_, `Na _) -> .
20402040+ | `FragmentRoot (`Na _) -> .
20412041+20422042+ and resolved_module_path :
19982043 _ -> Odoc_model.Paths.Path.Resolved.Module.t -> Cpath.Resolved.module_ =
19992044 fun ident_map p ->
20002000- let recurse = resolved_module_path ident_map in
20452045+ let p_c = (p :> Cpath.Resolved.module_) in
20012046 match p with
20022047 | `Identifier i -> (
20032003- match identifier find_any_module ident_map i with
20042004- | `Local l -> `Local l
20052005- | `Identifier _ -> `Gpath p)
20062006- | `Module (p, name) -> `Module (`Module (recurse p), name)
20072007- | `Apply (p1, p2) -> `Apply (recurse p1, recurse p2)
20082008- | `Alias (p1, p2) -> `Alias (recurse p1, module_path ident_map p2, None)
20482048+ match identifier_mod find_any_module ident_map i with
20492049+ | `LocalMod l -> `LocalMod (l :> Cpath.lmod)
20502050+ | `Identifier _ -> `Identifier i)
20512051+ | `Module (parent, name) ->
20522052+ let parent' = resolved_parent_path ident_map parent in
20532053+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
20542054+ else `Module (parent', name)
20552055+ | `Apply (p1, p2) ->
20562056+ let p1' = resolved_module_path ident_map p1 in
20572057+ let p2' = resolved_module_path ident_map p2 in
20582058+ if p1' == (p1 :> Cpath.Resolved.module_)
20592059+ && p2' == (p2 :> Cpath.Resolved.module_) then p_c
20602060+ else `Apply (p1', p2')
20612061+ | `Alias (p1, p2, _) ->
20622062+ let p1' = resolved_module_path ident_map p1 in
20632063+ let p2' = module_path ident_map p2 in
20642064+ if p1' == (p1 :> Cpath.Resolved.module_)
20652065+ && p2' == (p2 :> Cpath.module_) then p_c
20662066+ else `Alias (p1', p2', None)
20092067 | `Subst (p1, p2) ->
20102010- `Subst (resolved_module_type_path ident_map p1, recurse p2)
20112011- | `Canonical (p1, p2) -> `Canonical (recurse p1, p2)
20122012- | `Hidden p1 -> `Hidden (recurse p1)
20132013- | `OpaqueModule m -> `OpaqueModule (recurse m)
20142014- | `Substituted m -> `Substituted (recurse m)
20682068+ let p1' = resolved_module_type_path ident_map p1 in
20692069+ let p2' = resolved_module_path ident_map p2 in
20702070+ if p1' == (p1 :> Cpath.Resolved.module_type)
20712071+ && p2' == (p2 :> Cpath.Resolved.module_) then p_c
20722072+ else `Subst (p1', p2')
20732073+ | `Canonical (p1, p2) ->
20742074+ let p1' = resolved_module_path ident_map p1 in
20752075+ let p2' = module_path ident_map p2 in
20762076+ if p1' == (p1 :> Cpath.Resolved.module_)
20772077+ && p2' == (p2 :> Cpath.module_) then p_c
20782078+ else `Canonical (p1', p2')
20792079+ | `Hidden p1 ->
20802080+ let p1' = resolved_module_path ident_map p1 in
20812081+ if p1' == (p1 :> Cpath.Resolved.module_) then p_c
20822082+ else `Hidden p1'
20832083+ | `OpaqueModule m ->
20842084+ let m' = resolved_module_path ident_map m in
20852085+ if m' == (m :> Cpath.Resolved.module_) then p_c
20862086+ else `OpaqueModule m'
20872087+ | `Substituted m ->
20882088+ let m' = resolved_module_path ident_map m in
20892089+ if m' == (m :> Cpath.Resolved.module_) then p_c
20902090+ else `Substituted m'
20912091+ | `LocalMod (`Na _) -> .
2015209220162093 and resolved_module_type_path :
20172094 _ ->
20182095 Odoc_model.Paths.Path.Resolved.ModuleType.t ->
20192096 Cpath.Resolved.module_type =
20202097 fun ident_map p ->
20982098+ let p_c = (p :> Cpath.Resolved.module_type) in
20212099 match p with
20222100 | `Identifier i -> (
20232023- match identifier Maps.ModuleType.find ident_map.module_types i with
20242024- | `Local l -> `Local l
20252025- | `Identifier _ -> `Gpath p)
20262026- | `ModuleType (p, name) ->
20272027- `ModuleType (`Module (resolved_module_path ident_map p), name)
21012101+ match identifier_modty Maps.ModuleType.find ident_map.module_types i with
21022102+ | `LocalModTy l -> `LocalModTy (l :> Cpath.lmodty)
21032103+ | `Identifier _ -> `Identifier i)
21042104+ | `ModuleType (parent, name) ->
21052105+ let parent' = resolved_parent_path ident_map parent in
21062106+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
21072107+ else `ModuleType (parent', name)
20282108 | `CanonicalModuleType (p1, p2) ->
20292029- `CanonicalModuleType (resolved_module_type_path ident_map p1, p2)
21092109+ let p1' = resolved_module_type_path ident_map p1 in
21102110+ let p2' = module_type_path ident_map p2 in
21112111+ if p1' == (p1 :> Cpath.Resolved.module_type)
21122112+ && p2' == (p2 :> Cpath.module_type) then p_c
21132113+ else `CanonicalModuleType (p1', p2')
20302114 | `OpaqueModuleType m ->
20312031- `OpaqueModuleType (resolved_module_type_path ident_map m)
21152115+ let m' = resolved_module_type_path ident_map m in
21162116+ if m' == (m :> Cpath.Resolved.module_type) then p_c
21172117+ else `OpaqueModuleType m'
20322118 | `AliasModuleType (m1, m2) ->
20332033- `AliasModuleType
20342034- ( resolved_module_type_path ident_map m1,
20352035- resolved_module_type_path ident_map m2 )
21192119+ let m1' = resolved_module_type_path ident_map m1 in
21202120+ let m2' = resolved_module_type_path ident_map m2 in
21212121+ if m1' == (m1 :> Cpath.Resolved.module_type)
21222122+ && m2' == (m2 :> Cpath.Resolved.module_type) then p_c
21232123+ else `AliasModuleType (m1', m2')
20362124 | `SubstT (p1, p2) ->
20372037- `SubstT
20382038- ( resolved_module_type_path ident_map p1,
20392039- resolved_module_type_path ident_map p2 )
20402040- | `SubstitutedMT m -> `Substituted (resolved_module_type_path ident_map m)
21252125+ let p1' = resolved_module_type_path ident_map p1 in
21262126+ let p2' = resolved_module_type_path ident_map p2 in
21272127+ if p1' == (p1 :> Cpath.Resolved.module_type)
21282128+ && p2' == (p2 :> Cpath.Resolved.module_type) then p_c
21292129+ else `SubstT (p1', p2')
21302130+ | `SubstitutedMT m ->
21312131+ let m' = resolved_module_type_path ident_map m in
21322132+ if m' == (m :> Cpath.Resolved.module_type) then p_c
21332133+ else `SubstitutedMT m'
21342134+ | `LocalModTy (`Na _) -> .
2041213520422136 and resolved_type_path :
20432137 _ -> Odoc_model.Paths.Path.Resolved.Type.t -> Cpath.Resolved.type_ =
20442138 fun ident_map p ->
21392139+ let p_c = (p :> Cpath.Resolved.type_) in
20452140 match p with
20462046- | `CoreType _ as c -> c
21412141+ | `CoreType _ -> p_c
20472142 | `Identifier i -> (
20482048- match identifier Maps.Path.Type.find ident_map.path_types i with
20492049- | `Local l -> `Local l
20502050- | `Identifier _ -> `Gpath p)
21432143+ match identifier_ty Maps.Path.Type.find ident_map.path_types i with
21442144+ | `LocalTy l -> `LocalTy (l :> Cpath.lty)
21452145+ | `Identifier _ -> `Identifier i)
20512146 | `CanonicalType (p1, p2) ->
20522052- `CanonicalType (resolved_type_path ident_map p1, p2)
20532053- | `Type (p, name) -> `Type (`Module (resolved_module_path ident_map p), name)
20542054- | `Class (p, name) ->
20552055- `Class (`Module (resolved_module_path ident_map p), name)
20562056- | `ClassType (p, name) ->
20572057- `ClassType (`Module (resolved_module_path ident_map p), name)
20582058- | `SubstitutedT m -> `Substituted (resolved_type_path ident_map m)
21472147+ let p1' = resolved_type_path ident_map p1 in
21482148+ let p2' = type_path ident_map p2 in
21492149+ if p1' == (p1 :> Cpath.Resolved.type_)
21502150+ && p2' == (p2 :> Cpath.type_) then p_c
21512151+ else `CanonicalType (p1', p2')
21522152+ | `Type (parent, name) ->
21532153+ let parent' = resolved_parent_path ident_map parent in
21542154+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
21552155+ else `Type (parent', name)
21562156+ | `Class (parent, name) ->
21572157+ let parent' = resolved_parent_path ident_map parent in
21582158+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
21592159+ else `Class (parent', name)
21602160+ | `ClassType (parent, name) ->
21612161+ let parent' = resolved_parent_path ident_map parent in
21622162+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
21632163+ else `ClassType (parent', name)
21642164+ | `SubstitutedT m ->
21652165+ let m' = resolved_type_path ident_map m in
21662166+ if m' == (m :> Cpath.Resolved.type_) then p_c
21672167+ else `SubstitutedT m'
20592168 | `SubstitutedCT m ->
20602060- `Substituted
20612061- (resolved_class_type_path ident_map m :> Cpath.Resolved.type_)
21692169+ let m' = resolved_class_type_path ident_map m in
21702170+ if m' == (m :> Cpath.Resolved.class_type) then p_c
21712171+ else `SubstitutedCT m'
21722172+ | `LocalTy (`Na _) -> .
2062217320632174 and resolved_value_path :
20642175 _ -> Odoc_model.Paths.Path.Resolved.Value.t -> Cpath.Resolved.value =
20652176 fun ident_map p ->
21772177+ let p_c = (p :> Cpath.Resolved.value) in
20662178 match p with
20672067- | `Value (p, name) ->
20682068- `Value (`Module (resolved_module_path ident_map p), name)
20692069- | `Identifier _ -> `Gpath p
21792179+ | `Value (parent, name) ->
21802180+ let parent' = resolved_parent_path ident_map parent in
21812181+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
21822182+ else `Value (parent', name)
21832183+ | `Identifier _ -> p_c
21842184+ | `LocalVal (`Na _) -> .
2070218520712186 and resolved_class_type_path :
20722187 _ ->
20732188 Odoc_model.Paths.Path.Resolved.ClassType.t ->
20742189 Cpath.Resolved.class_type =
20752190 fun ident_map p ->
21912191+ let p_c = (p :> Cpath.Resolved.class_type) in
20762192 match p with
20772193 | `Identifier i -> (
20782194 match
20792079- identifier Maps.Path.ClassType.find ident_map.path_class_types i
21952195+ identifier_ty Maps.Path.ClassType.find ident_map.path_class_types i
20802196 with
20812081- | `Local l -> `Local l
20822082- | `Identifier _ -> `Gpath p)
20832083- | `Class (p, name) ->
20842084- `Class (`Module (resolved_module_path ident_map p), name)
20852085- | `ClassType (p, name) ->
20862086- `ClassType (`Module (resolved_module_path ident_map p), name)
20872087- | `SubstitutedCT c -> `Substituted (resolved_class_type_path ident_map c)
21972197+ | `LocalTy l -> `LocalTy (l :> Cpath.lty)
21982198+ | `Identifier _ -> `Identifier i)
21992199+ | `Class (parent, name) ->
22002200+ let parent' = resolved_parent_path ident_map parent in
22012201+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
22022202+ else `Class (parent', name)
22032203+ | `ClassType (parent, name) ->
22042204+ let parent' = resolved_parent_path ident_map parent in
22052205+ if parent' == (parent :> Cpath.Resolved.parent) then p_c
22062206+ else `ClassType (parent', name)
22072207+ | `SubstitutedCT c ->
22082208+ let c' = resolved_class_type_path ident_map c in
22092209+ if c' == (c :> Cpath.Resolved.class_type) then p_c
22102210+ else `SubstitutedCT c'
22112211+ | `LocalTy (`Na _) -> .
2088221220892213 and module_path : _ -> Odoc_model.Paths.Path.Module.t -> Cpath.module_ =
20902214 fun ident_map p ->
22152215+ let p_c = (p :> Cpath.module_) in
20912216 match p with
20922092- | `Resolved r -> `Resolved (resolved_module_path ident_map r)
20932093- | `Substituted m -> `Substituted (module_path ident_map m)
22172217+ | `Resolved r ->
22182218+ let r' = resolved_module_path ident_map r in
22192219+ if r' == (r :> Cpath.Resolved.module_) then p_c
22202220+ else `Resolved r'
22212221+ | `Substituted m ->
22222222+ let m' = module_path ident_map m in
22232223+ if m' == (m :> Cpath.module_) then p_c
22242224+ else `Substituted m'
20942225 | `Identifier (i, b) -> (
20952095- match identifier find_any_module ident_map i with
20962096- | `Identifier i -> `Identifier (i, b)
20972097- | `Local i -> `Local (i, b))
20982098- | `Dot (path', x) -> `Dot (module_path ident_map path', x)
22262226+ match identifier_mod find_any_module ident_map i with
22272227+ | `Identifier _ -> p_c
22282228+ | `LocalMod i -> `LocalMod (i :> Cpath.lmod))
22292229+ | `Dot (path', x) ->
22302230+ let path'' = module_path ident_map path' in
22312231+ if path'' == (path' :> Cpath.module_) then p_c
22322232+ else `Dot (path'', x)
20992233 | `Apply (p1, p2) ->
21002100- `Apply (module_path ident_map p1, module_path ident_map p2)
21012101- | `Forward str -> `Forward str
21022102- | `Root str -> `Root str
22342234+ let p1' = module_path ident_map p1 in
22352235+ let p2' = module_path ident_map p2 in
22362236+ if p1' == (p1 :> Cpath.module_)
22372237+ && p2' == (p2 :> Cpath.module_) then p_c
22382238+ else `Apply (p1', p2')
22392239+ | `Forward _ | `Root _ -> p_c
22402240+ | `Module (`Na _, _, _) -> .
22412241+ | `LocalMod (`Na _) -> .
2103224221042243 and module_type_path :
21052244 _ -> Odoc_model.Paths.Path.ModuleType.t -> Cpath.module_type =
21062245 fun ident_map p ->
22462246+ let p_c = (p :> Cpath.module_type) in
21072247 match p with
21082108- | `Resolved r -> `Resolved (resolved_module_type_path ident_map r)
21092109- | `SubstitutedMT m -> `Substituted (module_type_path ident_map m)
21102110- | `Identifier (i, b) -> (
21112111- match identifier Maps.ModuleType.find ident_map.module_types i with
21122112- | `Identifier i -> `Identifier (i, b)
21132113- | `Local i -> `Local (i, b))
21142114- | `DotMT (path', x) -> `DotMT (module_path ident_map path', x)
22482248+ | `Resolved r ->
22492249+ let r' = resolved_module_type_path ident_map r in
22502250+ if r' == (r :> Cpath.Resolved.module_type) then p_c
22512251+ else `Resolved r'
22522252+ | `SubstitutedMT m ->
22532253+ let m' = module_type_path ident_map m in
22542254+ if m' == (m :> Cpath.module_type) then p_c
22552255+ else `SubstitutedMT m'
22562256+ | `Identifier (i, _) -> (
22572257+ match identifier_modty Maps.ModuleType.find ident_map.module_types i with
22582258+ | `Identifier _ -> p_c
22592259+ | `LocalModTy i -> `LocalModTy (i :> Cpath.lmodty))
22602260+ | `DotMT (path', x) ->
22612261+ let path'' = module_path ident_map path' in
22622262+ if path'' == (path' :> Cpath.module_) then p_c
22632263+ else `DotMT (path'', x)
22642264+ | `ModuleType (`Na _, _, _) -> .
22652265+ | `LocalModTy (`Na _) -> .
2115226621162267 and type_path : _ -> Odoc_model.Paths.Path.Type.t -> Cpath.type_ =
21172268 fun ident_map p ->
22692269+ let p_c = (p :> Cpath.type_) in
21182270 match p with
21192119- | `Resolved r -> `Resolved (resolved_type_path ident_map r)
21202120- | `SubstitutedT t -> `Substituted (type_path ident_map t)
21212121- | `Identifier (i, b) -> (
21222122- match identifier Maps.Path.Type.find ident_map.path_types i with
21232123- | `Identifier i -> `Identifier (i, b)
21242124- | `Local i -> `Local (i, b))
21252125- | `DotT (path', x) -> `DotT (module_path ident_map path', x)
22712271+ | `Resolved r ->
22722272+ let r' = resolved_type_path ident_map r in
22732273+ if r' == (r :> Cpath.Resolved.type_) then p_c
22742274+ else `Resolved r'
22752275+ | `SubstitutedT t ->
22762276+ let t' = type_path ident_map t in
22772277+ if t' == (t :> Cpath.type_) then p_c
22782278+ else `SubstitutedT t'
22792279+ | `Identifier (i, _) -> (
22802280+ match identifier_ty Maps.Path.Type.find ident_map.path_types i with
22812281+ | `Identifier _ -> p_c
22822282+ | `LocalTy i -> `LocalTy (i :> Cpath.lty))
22832283+ | `DotT (path', x) ->
22842284+ let path'' = module_path ident_map path' in
22852285+ if path'' == (path' :> Cpath.module_) then p_c
22862286+ else `DotT (path'', x)
22872287+ | `Type (`Na _, _, _) -> .
22882288+ | `SubstitutedCT _ -> assert false (* shouldn't appear in model type paths *)
22892289+ | `LocalTy (`Na _) -> .
2126229021272291 and value_path : _ -> Odoc_model.Paths.Path.Value.t -> Cpath.value =
21282292 fun ident_map p ->
22932293+ let p_c = (p :> Cpath.value) in
21292294 match p with
21302130- | `Resolved r -> `Resolved (resolved_value_path ident_map r)
21312131- | `DotV (path', x) -> `DotV (module_path ident_map path', x)
21322132- | `Identifier (i, b) -> `Identifier (i, b)
22952295+ | `Resolved r ->
22962296+ let r' = resolved_value_path ident_map r in
22972297+ if r' == (r :> Cpath.Resolved.value) then p_c
22982298+ else `Resolved r'
22992299+ | `DotV (path', x) ->
23002300+ let path'' = module_path ident_map path' in
23012301+ if path'' == (path' :> Cpath.module_) then p_c
23022302+ else `DotV (path'', x)
23032303+ | `Identifier _ -> p_c
23042304+ | `LocalVal (`Na _) -> .
2133230521342306 and class_type_path :
21352307 _ -> Odoc_model.Paths.Path.ClassType.t -> Cpath.class_type =
21362308 fun ident_map p ->
23092309+ let p_c = (p :> Cpath.class_type) in
21372310 match p with
21382138- | `Resolved r -> `Resolved (resolved_class_type_path ident_map r)
21392139- | `SubstitutedCT c -> `Substituted (class_type_path ident_map c)
21402140- | `Identifier (i, b) -> (
23112311+ | `Resolved r ->
23122312+ let r' = resolved_class_type_path ident_map r in
23132313+ if r' == (r :> Cpath.Resolved.class_type) then p_c
23142314+ else `Resolved r'
23152315+ | `SubstitutedCT c ->
23162316+ let c' = class_type_path ident_map c in
23172317+ if c' == (c :> Cpath.class_type) then p_c
23182318+ else `SubstitutedCT c'
23192319+ | `Identifier (i, _) -> (
21412320 match
21422142- identifier Maps.Path.ClassType.find ident_map.path_class_types i
23212321+ identifier_ty Maps.Path.ClassType.find ident_map.path_class_types i
21432322 with
21442144- | `Identifier i -> `Identifier (i, b)
21452145- | `Local i -> `Local (i, b))
21462146- | `DotT (path', x) -> `DotT (module_path ident_map path', x)
23232323+ | `Identifier _ -> p_c
23242324+ | `LocalTy i -> `LocalTy (i :> Cpath.lty))
23252325+ | `DotT (path', x) ->
23262326+ let path'' = module_path ident_map path' in
23272327+ if path'' == (path' :> Cpath.module_) then p_c
23282328+ else `DotT (path'', x)
23292329+ | `Type (`Na _, _, _) -> .
23302330+ | `LocalTy (`Na _) -> .
2147233121482332 let rec resolved_signature_fragment :
21492333 map ->
-3
odoc/src/xref2/component.mli
···700700701701 val empty : unit -> map
702702703703- val identifier :
704704- ('a -> 'b -> 'c) -> 'b -> 'a -> [> `Identifier of 'a | `Local of 'c ]
705705-706703 val resolved_module_path :
707704 map -> Odoc_model.Paths.Path.Resolved.Module.t -> Cpath.Resolved.module_
708705
+98-220
odoc/src/xref2/cpath.ml
···11open Odoc_model.Paths
22open Odoc_model.Names
3344+type lmod = [ Ident.module_ | Odoc_model.Paths.na ]
55+type lmodty = [ Ident.module_type | Odoc_model.Paths.na ]
66+type lty = [ Ident.type_ | Odoc_model.Paths.na ]
77+type lval = [ Ident.value | Odoc_model.Paths.na ]
88+type pty = [ `U | Odoc_model.Paths.na ]
99+410module rec Resolved : sig
55- type parent =
66- [ `Module of module_ | `ModuleType of module_type | `FragmentRoot ]
1111+ type parent = (lmod, lmodty, pty) Odoc_model.Paths.Path.Resolved.parent_gen
71288- and module_ =
99- [ `Local of Ident.module_
1010- | `Gpath of Path.Resolved.Module.t
1111- | `Substituted of module_
1212- | `Subst of module_type * module_
1313- | `Hidden of module_
1414- | `Module of parent * ModuleName.t
1515- | `Canonical of module_ * Path.Module.t
1616- | `Apply of module_ * module_
1717- | `Alias of module_ * Cpath.module_ * module_ option
1818- | `OpaqueModule of module_ ]
1313+ type module_ = (lmod, lmodty, pty) Odoc_model.Paths.Path.Resolved.Module.gen
19142020- and module_type =
2121- [ `Local of Ident.module_type
2222- | `Substituted of module_type
2323- | `Gpath of Path.Resolved.ModuleType.t
2424- | `ModuleType of parent * ModuleTypeName.t
2525- | `SubstT of module_type * module_type
2626- | `AliasModuleType of module_type * module_type
2727- | `CanonicalModuleType of module_type * Path.ModuleType.t
2828- | `OpaqueModuleType of module_type ]
1515+ type module_type =
1616+ (lmod, lmodty, pty) Odoc_model.Paths.Path.Resolved.ModuleType.gen
29173030- and type_ =
3131- [ `Local of Ident.type_
3232- | `Gpath of Path.Resolved.Type.t
3333- | `Substituted of type_
3434- | `CanonicalType of type_ * Path.Type.t
3535- | `CoreType of TypeName.t
3636- | `Type of parent * TypeName.t
3737- | `Class of parent * TypeName.t
3838- | `ClassType of parent * TypeName.t ]
1818+ type type_ =
1919+ (lmod, lmodty, pty, lty) Odoc_model.Paths.Path.Resolved.Type.gen
39204040- and value =
4141- [ `Value of parent * ValueName.t | `Gpath of Path.Resolved.Value.t ]
2121+ type class_type =
2222+ (lmod, lmodty, pty, lty) Odoc_model.Paths.Path.Resolved.ClassType.gen
42234343- and class_type =
4444- [ `Local of Ident.type_
4545- | `Substituted of class_type
4646- | `Gpath of Path.Resolved.ClassType.t
4747- | `Class of parent * TypeName.t
4848- | `ClassType of parent * TypeName.t ]
2424+ type value =
2525+ (lmod, lmodty, pty, lval) Odoc_model.Paths.Path.Resolved.Value.gen
2626+2727+ type any = (lmod, lmodty, pty, lty, lval) Odoc_model.Paths.Path.Resolved.gen
4928end =
5029 Resolved
51305231and Cpath : sig
5353- type module_ =
5454- [ `Resolved of Resolved.module_
5555- | `Substituted of module_
5656- | `Local of Ident.module_ * bool
5757- | `Identifier of Identifier.Path.Module.t * bool
5858- | `Root of ModuleName.t
5959- | `Forward of string
6060- | `Dot of module_ * ModuleName.t
6161- | `Module of Resolved.parent * ModuleName.t (* Like dot, but typed *)
6262- | `Apply of module_ * module_ ]
3232+ type module_ = (lmod, lmodty, pty) Odoc_model.Paths.Path.Module.gen
63336464- and module_type =
6565- [ `Resolved of Resolved.module_type
6666- | `Substituted of module_type
6767- | `Local of Ident.module_type * bool
6868- | `Identifier of Identifier.ModuleType.t * bool
6969- | `DotMT of module_ * ModuleTypeName.t
7070- | `ModuleType of Resolved.parent * ModuleTypeName.t ]
3434+ type module_type = (lmod, lmodty, pty) Odoc_model.Paths.Path.ModuleType.gen
3535+3636+ type type_ = (lmod, lmodty, pty, lty) Odoc_model.Paths.Path.Type.gen
71377272- and type_ =
7373- [ `Resolved of Resolved.type_
7474- | `Substituted of type_
7575- | `Local of Ident.type_ * bool
7676- | `Identifier of Odoc_model.Paths.Identifier.Path.Type.t * bool
7777- | `DotT of module_ * TypeName.t
7878- | `Type of Resolved.parent * TypeName.t
7979- | `Class of Resolved.parent * TypeName.t
8080- | `ClassType of Resolved.parent * TypeName.t ]
3838+ type class_type = (lmod, lmodty, pty, lty) Odoc_model.Paths.Path.ClassType.gen
81398282- and value =
8383- [ `Resolved of Resolved.value
8484- | `DotV of module_ * ValueName.t
8585- | `Value of Resolved.parent * ValueName.t
8686- | `Identifier of Identifier.Value.t * bool ]
4040+ type value = (lmod, lmodty, pty, lval) Odoc_model.Paths.Path.Value.gen
87418888- and class_type =
8989- [ `Resolved of Resolved.class_type
9090- | `Substituted of class_type
9191- | `Local of Ident.type_ * bool
9292- | `Identifier of Odoc_model.Paths.Identifier.Path.ClassType.t * bool
9393- | `DotT of module_ * TypeName.t
9494- | `Class of Resolved.parent * TypeName.t
9595- | `ClassType of Resolved.parent * TypeName.t ]
4242+ type any = (lmod, lmodty, pty, lty, lval) Odoc_model.Paths.Path.gen
9643end =
9744 Cpath
98459946include Cpath
100474848+let hidden_fns :
4949+ (lmod, lmodty, pty, lty, lval, bool) Odoc_model.Paths.Path.genfn5 =
5050+ {
5151+ g =
5252+ {
5353+ lmod =
5454+ (function `LModule (n, _) -> ModuleName.is_hidden n | `Na _ -> .);
5555+ lmodty =
5656+ (function
5757+ | `LModuleType (n, _) -> ModuleTypeName.is_hidden n | `Na _ -> .);
5858+ pty = (function _ -> false);
5959+ };
6060+ lty = (function `LType (n, _) -> TypeName.is_hidden n | `Na _ -> .);
6161+ lval = (function `LValue (n, _) -> ValueName.is_hidden n | `Na _ -> .);
6262+ }
6363+6464+let is_hidden : any -> bool =
6565+ Odoc_model.Paths.Path.is_hidden_gen hidden_fns
6666+6767+let is_resolved_hidden : weak_canonical_test:bool -> Resolved.any -> bool =
6868+ fun ~weak_canonical_test ->
6969+ Odoc_model.Paths.Path.is_resolved_hidden_gen ~weak_canonical_test hidden_fns
7070+10171let rec is_resolved_module_substituted : Resolved.module_ -> bool = function
102102- | `Local _ -> false
7272+ | `LocalMod _ -> false
10373 | `Substituted _ -> true
104104- | `Gpath _ -> false
7474+ | `Identifier _ -> false
10575 | `Subst (_a, _) -> false (* is_resolved_module_type_substituted a*)
10676 | `Hidden a | `Apply (a, _) | `Alias (a, _, _) | `Canonical (a, _) ->
10777 is_resolved_module_substituted a
···1108011181and is_resolved_parent_substituted = function
11282 | `Module m -> is_resolved_module_substituted m
113113- | `ModuleType m -> is_resolved_module_type_substituted m
114114- | `FragmentRoot -> false
8383+ | `ModuleType (m, `U) -> is_resolved_module_type_substituted m
8484+ | `FragmentRoot `U -> false
8585+ | `ModuleType (_, `Na _) -> .
8686+ | `FragmentRoot (`Na _) -> .
1158711688and is_resolved_module_type_substituted : Resolved.module_type -> bool =
11789 function
118118- | `Local _ -> false
119119- | `Substituted _ -> true
120120- | `Gpath _ -> false
9090+ | `LocalModTy _ -> false
9191+ | `SubstitutedMT _ -> true
9292+ | `Identifier _ -> false
12193 | `ModuleType (a, _) -> is_resolved_parent_substituted a
12294 | `SubstT _ -> false
12395 | `AliasModuleType (m1, _) -> is_resolved_module_type_substituted m1
···12597 is_resolved_module_type_substituted m
1269812799and is_resolved_type_substituted : Resolved.type_ -> bool = function
128128- | `Local _ -> false
100100+ | `LocalTy _ -> false
129101 | `CoreType _ -> false
130130- | `Substituted _ -> true
131131- | `Gpath _ -> false
102102+ | `SubstitutedT _ -> true
103103+ | `SubstitutedCT _ -> true
104104+ | `Identifier _ -> false
132105 | `CanonicalType (t, _) -> is_resolved_type_substituted t
133106 | `Type (a, _) | `Class (a, _) | `ClassType (a, _) ->
134107 is_resolved_parent_substituted a
135108136109and is_resolved_class_type_substituted : Resolved.class_type -> bool = function
137137- | `Local _ -> false
138138- | `Substituted _ -> true
139139- | `Gpath _ -> false
110110+ | `LocalTy _ -> false
111111+ | `SubstitutedCT _ -> true
112112+ | `Identifier _ -> false
140113 | `Class (a, _) | `ClassType (a, _) -> is_resolved_parent_substituted a
141114142115let rec is_module_substituted : module_ -> bool = function
143116 | `Resolved a -> is_resolved_module_substituted a
144117 | `Identifier _ -> false
145145- | `Local _ -> false
118118+ | `LocalMod _ -> false
146119 | `Substituted _ -> true
147120 | `Dot (a, _) | `Apply (a, _) -> is_module_substituted a
121121+ | `Module (_, p, _) -> is_resolved_parent_substituted p
148122 | `Forward _ -> false
149123 | `Root _ -> false
150150- | `Module (a, _) -> is_resolved_parent_substituted a
151124152125let is_module_type_substituted : module_type -> bool = function
153126 | `Resolved a -> is_resolved_module_type_substituted a
154127 | `Identifier _ -> false
155155- | `Local _ -> false
156156- | `Substituted _ -> true
128128+ | `LocalModTy _ -> false
129129+ | `SubstitutedMT _ -> true
157130 | `DotMT (a, _) -> is_module_substituted a
158158- | `ModuleType (a, _) -> is_resolved_parent_substituted a
131131+ | `ModuleType (_, p, _) -> is_resolved_parent_substituted p
159132160133let is_type_substituted : type_ -> bool = function
161134 | `Resolved a -> is_resolved_type_substituted a
162135 | `Identifier _ -> false
163163- | `Local _ -> false
164164- | `Substituted _ -> true
136136+ | `LocalTy _ -> false
137137+ | `SubstitutedT _ -> true
138138+ | `SubstitutedCT _ -> true
165139 | `DotT (a, _) -> is_module_substituted a
166166- | `Type (a, _) | `Class (a, _) | `ClassType (a, _) ->
167167- is_resolved_parent_substituted a
140140+ | `Type (_, p, _) -> is_resolved_parent_substituted p
168141169142let is_class_type_substituted : class_type -> bool = function
170143 | `Resolved a -> is_resolved_class_type_substituted a
171144 | `Identifier _ -> false
172172- | `Local _ -> false
173173- | `Substituted _ -> true
145145+ | `SubstitutedCT _ -> true
174146 | `DotT (a, _) -> is_module_substituted a
175175- | `Class (a, _) | `ClassType (a, _) -> is_resolved_parent_substituted a
147147+ | `LocalTy _ -> false
148148+ | `Type (_, p, _) -> is_resolved_parent_substituted p
176149177150let rec is_module_forward : module_ -> bool = function
178151 | `Forward _ -> true
179152 | `Resolved _ -> false
180153 | `Root _ -> false
181154 | `Identifier _ -> false
182182- | `Local _ -> false
155155+ | `LocalMod _ -> false
183156 | `Substituted p | `Dot (p, _) | `Apply (p, _) -> is_module_forward p
184184- | `Module (_, _) -> false
185185-186186-let rec is_module_hidden : module_ -> bool = function
187187- | `Resolved r -> is_resolved_module_hidden ~weak_canonical_test:false r
188188- | `Substituted p | `Dot (p, _) | `Apply (p, _) -> is_module_hidden p
189189- | `Identifier (_, b) -> b
190190- | `Local (_, b) -> b
191191- | `Forward _ -> false
192192- | `Root _ -> false
193193- | `Module (p, _) -> is_resolved_parent_hidden ~weak_canonical_test:false p
194194-195195-and is_resolved_module_hidden :
196196- weak_canonical_test:bool -> Resolved.module_ -> bool =
197197- fun ~weak_canonical_test ->
198198- let rec inner = function
199199- | `Local _ -> false
200200- | `Gpath p ->
201201- Odoc_model.Paths.Path.Resolved.Module.is_hidden ~weak_canonical_test p
202202- | `Hidden _ -> true
203203- | `Canonical (_, `Resolved _) -> false
204204- | `Canonical (p, _) -> (not weak_canonical_test) && inner p
205205- | `Substituted p -> inner p
206206- | `Module (p, _) -> is_resolved_parent_hidden ~weak_canonical_test p
207207- | `Subst (p1, p2) -> is_resolved_module_type_hidden p1 || inner p2
208208- | `Alias (p1, `Resolved p2, _) -> inner p1 && inner p2
209209- | `Alias (p1, _p2, _) -> inner p1
210210- | `Apply (p1, p2) -> inner p1 || inner p2
211211- | `OpaqueModule m -> inner m
212212- in
213213- inner
214214-215215-and is_resolved_parent_hidden :
216216- weak_canonical_test:bool -> Resolved.parent -> bool =
217217- fun ~weak_canonical_test -> function
218218- | `Module m -> is_resolved_module_hidden ~weak_canonical_test m
219219- | `ModuleType m -> is_resolved_module_type_hidden m
220220- | `FragmentRoot -> false
221221-222222-and is_module_type_hidden : module_type -> bool = function
223223- | `Resolved r -> is_resolved_module_type_hidden r
224224- | `Identifier ({ iv = `ModuleType (_, t); _ }, b) ->
225225- b || ModuleTypeName.is_hidden t
226226- | `Local (_, b) -> b
227227- | `Substituted p -> is_module_type_hidden p
228228- | `DotMT (p, _) -> is_module_hidden p
229229- | `ModuleType (p, _) -> is_resolved_parent_hidden ~weak_canonical_test:false p
230230-231231-and is_resolved_module_type_hidden : Resolved.module_type -> bool = function
232232- | `Local _ -> false
233233- | `Gpath p -> Odoc_model.Paths.Path.Resolved.(is_hidden (p :> t))
234234- | `Substituted p -> is_resolved_module_type_hidden p
235235- | `ModuleType (p, _) -> is_resolved_parent_hidden ~weak_canonical_test:false p
236236- | `SubstT (p1, p2) ->
237237- is_resolved_module_type_hidden p1 || is_resolved_module_type_hidden p2
238238- | `AliasModuleType (p1, p2) ->
239239- is_resolved_module_type_hidden p1 || is_resolved_module_type_hidden p2
240240- | `CanonicalModuleType (_, `Resolved _) -> false
241241- | `CanonicalModuleType (p, _) -> is_resolved_module_type_hidden p
242242- | `OpaqueModuleType m -> is_resolved_module_type_substituted m
243243-244244-and is_type_hidden : type_ -> bool = function
245245- | `Resolved r -> is_resolved_type_hidden r
246246- | `Identifier ({ iv = `Type (_, t); _ }, b) -> b || TypeName.is_hidden t
247247- | `Identifier ({ iv = `ClassType (_, t); _ }, b) -> b || TypeName.is_hidden t
248248- | `Identifier ({ iv = `Class (_, t); _ }, b) -> b || TypeName.is_hidden t
249249- | `Local (_, b) -> b
250250- | `Substituted p -> is_type_hidden (p :> type_)
251251- | `DotT (p, _) -> is_module_hidden p
252252- | `Type (p, _) | `Class (p, _) | `ClassType (p, _) ->
253253- is_resolved_parent_hidden ~weak_canonical_test:false p
254254-255255-and is_resolved_type_hidden : Resolved.type_ -> bool = function
256256- | `CoreType n -> TypeName.is_hidden n
257257- | `Local _ -> false
258258- | `Gpath p -> Odoc_model.Paths.Path.Resolved.(is_hidden (p :> t))
259259- | `Substituted p -> is_resolved_type_hidden p
260260- | `CanonicalType (_, `Resolved _) -> false
261261- | `CanonicalType (p, _) -> is_resolved_type_hidden p
262262- | `Type (p, _) | `Class (p, _) | `ClassType (p, _) ->
263263- is_resolved_parent_hidden ~weak_canonical_test:false p
264264-265265-and is_resolved_class_type_hidden : Resolved.class_type -> bool = function
266266- | `Local _ -> false
267267- | `Gpath p -> Odoc_model.Paths.Path.Resolved.(is_hidden (p :> t))
268268- | `Substituted p -> is_resolved_class_type_hidden p
269269- | `Class (p, _) | `ClassType (p, _) ->
270270- is_resolved_parent_hidden ~weak_canonical_test:false p
271271-272272-and is_class_type_hidden : class_type -> bool = function
273273- | `Resolved r -> is_resolved_class_type_hidden r
274274- | `Identifier (_, b) -> b
275275- | `Local (_, b) -> b
276276- | `Substituted p -> is_class_type_hidden p
277277- | `DotT (p, _) -> is_module_hidden p
278278- | `Class (p, _) | `ClassType (p, _) ->
279279- is_resolved_parent_hidden ~weak_canonical_test:false p
157157+ | `Module (_, _, _) -> false
280158281159let rec resolved_module_of_resolved_module_reference :
282160 Reference.Resolved.Module.t -> Resolved.module_ = function
283161 | `Module (parent, name) ->
284162 `Module
285163 (`Module (resolved_module_of_resolved_signature_reference parent), name)
286286- | `Identifier x -> `Gpath (`Identifier x)
164164+ | `Identifier x -> `Identifier x
287165 | `Alias (_m1, _m2) -> failwith "gah"
288166 | `Hidden s -> `Hidden (resolved_module_of_resolved_module_reference s)
289167290168and resolved_module_of_resolved_signature_reference :
291169 Reference.Resolved.Signature.t -> Resolved.module_ = function
292292- | `Identifier ({ iv = #Identifier.Module.t_pv; _ } as i) ->
293293- `Gpath (`Identifier i)
170170+ | `Identifier ({ iv = #Identifier.Module.t_pv; _ } as i) -> `Identifier i
294171 | (`Alias _ | `Module _ | `Hidden _) as r' ->
295172 resolved_module_of_resolved_module_reference r'
296173 | `ModuleType (_, n) ->
···316193 | _ -> failwith "Not a module reference"
317194318195let rec unresolve_resolved_module_path : Resolved.module_ -> module_ = function
319319- | `Hidden (`Gpath (`Identifier x)) -> `Identifier (x, true)
320320- | `Gpath (`Identifier x) ->
196196+ | `Hidden (`Identifier x) -> `Identifier (x, true)
197197+ | `Identifier x ->
321198 let hidden =
322199 match x.iv with
323200 | `Module (_, n) -> Odoc_model.Names.ModuleName.is_hidden n
324201 | _ -> false
325202 in
326203 `Identifier (x, hidden)
327327- | `Gpath _ as x -> `Resolved x
328328- | `Hidden (`Local x) -> `Local (x, true)
329329- | `Local x -> `Local (x, false)
204204+ | `Hidden (`LocalMod x) -> `LocalMod x
205205+ | `LocalMod x -> `LocalMod x
330206 | `Substituted x -> unresolve_resolved_module_path x
331207 | `Subst (_, x) -> unresolve_resolved_module_path x
332208 | `Hidden x -> unresolve_resolved_module_path x (* should assert false here *)
···341217and unresolve_module_path : module_ -> module_ = function
342218 | `Resolved x -> unresolve_resolved_module_path x
343219 | `Substituted x -> unresolve_module_path x
344344- | `Local (_, _) as x -> x
220220+ | `LocalMod _ as x -> x
345221 | `Identifier _ as x -> x
346222 | `Root _ as x -> x
347223 | `Forward _ as x -> x
348224 | `Dot (p, x) -> `Dot (unresolve_module_path p, x)
349349- | `Module (p, x) -> `Dot (unresolve_resolved_parent_path p, x)
225225+ | `Module (_, p, x) -> `Dot (unresolve_resolved_parent_path p, x)
350226 | `Apply (x, y) -> `Apply (unresolve_module_path x, unresolve_module_path y)
351227352228and unresolve_resolved_module_type_path : Resolved.module_type -> module_type =
353229 function
354354- | (`Local _ | `Gpath _) as p -> `Resolved p
355355- | `Substituted x -> unresolve_resolved_module_type_path x
230230+ | `LocalModTy _ as p -> p
231231+ | `Identifier x -> `Identifier (x, false)
232232+ | `SubstitutedMT x -> unresolve_resolved_module_type_path x
356233 | `ModuleType (p, n) -> `DotMT (unresolve_resolved_parent_path p, n)
357234 | `SubstT (_, m) -> unresolve_resolved_module_type_path m
358235 | `AliasModuleType (_, m2) -> unresolve_resolved_module_type_path m2
···361238362239and unresolve_resolved_parent_path : Resolved.parent -> module_ = function
363240 | `Module m -> unresolve_resolved_module_path m
364364- | `FragmentRoot | `ModuleType _ -> assert false
241241+ | `FragmentRoot _ | `ModuleType _ -> assert false
365242366243and unresolve_resolved_type_path : Resolved.type_ -> type_ = function
367367- | (`Gpath _ | `Local _ | `CoreType _) as p -> `Resolved p
368368- | `Substituted x -> unresolve_resolved_type_path x
244244+ | (`LocalTy _ | `Identifier _ | `CoreType _) as p -> `Resolved p
245245+ | `SubstitutedT x -> unresolve_resolved_type_path x
246246+ | `SubstitutedCT _x -> failwith "unhandled"
369247 | `CanonicalType (t1, _) -> unresolve_resolved_type_path t1
370248 | `Type (p, n) -> `DotT (unresolve_resolved_parent_path p, n)
371249 | `Class (p, n) -> `DotT (unresolve_resolved_parent_path p, n)
···373251374252and unresolve_resolved_class_type_path : Resolved.class_type -> class_type =
375253 function
376376- | (`Local _ | `Gpath _) as p -> `Resolved p
377377- | `Substituted x -> unresolve_resolved_class_type_path x
254254+ | (`LocalTy _ | `Identifier _) as p -> `Resolved p
255255+ | `SubstitutedCT x -> unresolve_resolved_class_type_path x
378256 | `Class (p, n) -> `DotT (unresolve_resolved_parent_path p, n)
379257 | `ClassType (p, n) -> `DotT (unresolve_resolved_parent_path p, n)
380258···383261 | y -> y
384262385263and unresolve_type_path : type_ -> type_ = function
386386- | `Resolved m -> (unresolve_resolved_type_path m :> type_)
264264+ | `Resolved m -> unresolve_resolved_type_path m
387265 | y -> y
388266389267and unresolve_class_type_path : class_type -> class_type = function
···415293 | Some i -> Some (`Resolved i)
416294 | None -> None)
417295 | `Substituted p -> original_path_cpath p
418418- | `Local _ ->
296296+ | `LocalMod _ ->
419297 None
420298 | `Module _ ->
421299 None
···429307 match original_path_parent_identifier sg with
430308 | Some sg' -> Some (`Module (sg', name))
431309 | None -> None)
432432- | `Root _ -> Some (`Gpath (`Identifier id))
310310+ | `Root _ -> Some (`Identifier id)
433311 | _ ->
434312 None
435313
+1-1
odoc/src/xref2/env.ml
···730730 in
731731 let doc = m.Component.Module.doc in
732732 let m = Component.Delayed.put_val (Subst.module_ subst m) in
733733- let rp = `Gpath (`Identifier identifier) in
733733+ let rp = `Identifier identifier in
734734 let p = `Resolved rp in
735735 let env' = add_module identifier m doc env in
736736 (env', Subst.add_module ident p rp subst)
+2-2
odoc/src/xref2/errors.ml
···254254 | None -> kind_of_module_cpath b)
255255 | _ -> None
256256257257-let rec kind_of_module_type_cpath = function
258258- | `Substituted p' -> kind_of_module_type_cpath p'
257257+let rec kind_of_module_type_cpath : Cpath.module_type -> kind option = function
258258+ | `SubstitutedMT p' -> kind_of_module_type_cpath p'
259259 | `DotMT (p', _) -> kind_of_module_cpath p'
260260 | _ -> None
261261
+1-1
odoc/src/xref2/expand_tools.ml
···1717 let env' =
1818 Env.add_module identifier (Component.Delayed.put_val m) m.doc env
1919 in
2020- let rp = `Gpath (`Identifier identifier) in
2020+ let rp = `Identifier identifier in
2121 let p = `Resolved rp in
2222 let subst =
2323 Subst.add_module (arg.id :> Ident.module_) p rp Subst.identity
+6
odoc/src/xref2/find.ml
···7373 match inner f i.Include.expansion_.items with
7474 | Some _ as x -> x
7575 | None -> inner f tl)
7676+ | Signature.Open o :: tl -> (
7777+ match inner f o.Open.expansion.items with
7878+ | Some _ as x -> x
7979+ | None -> inner f tl)
7680 | hd :: tl -> ( match f hd with Some _ as x -> x | None -> inner f tl)
7781 | [] -> None
7882 in
···8286 let rec inner f = function
8387 | Signature.Include i :: tl ->
8488 inner f i.Include.expansion_.items @ inner f tl
8989+ | Signature.Open o :: tl ->
9090+ inner f o.Open.expansion.items @ inner f tl
8591 | hd :: tl -> (
8692 match f hd with Some x -> x :: inner f tl | None -> inner f tl)
8793 | [] -> []
+59-43
odoc/src/xref2/lang_of.ml
···5656 let rec module_ map (p : Cpath.module_) : Odoc_model.Paths.Path.Module.t =
5757 match p with
5858 | `Substituted x -> `Substituted (module_ map x)
5959- | `Local (id, b) ->
5959+ | `LocalMod (`Na _) -> .
6060+ | `LocalMod (#Ident.module_ as id) ->
6061 let m =
6162 try lookup_module map id
6263 with Not_found ->
6364 failwith (Format.asprintf "Not_found: %a" Ident.fmt id)
6465 in
6566 let hidden =
6666- b
6767- ||
6867 match m.iv with
6968 | `Module (_, n) -> Odoc_model.Names.ModuleName.is_hidden n
7069 | _ -> false
···7675 | `Dot (p, s) -> `Dot (module_ map p, s)
7776 | `Forward s -> `Forward s
7877 | `Apply (m1, m2) -> `Apply (module_ map m1, module_ map m2)
7979- | `Module (`Module p, n) -> `Dot (`Resolved (resolved_module map p), n)
8080- | `Module (_, _) -> failwith "Probably shouldn't happen"
7878+ | `Module (_, `Module p, n) -> `Dot (`Resolved (resolved_module map p), n)
7979+ | `Module (_, _, _) -> failwith "Probably shouldn't happen"
81808281 and module_type map (p : Cpath.module_type) :
8382 Odoc_model.Paths.Path.ModuleType.t =
8483 match p with
8585- | `Substituted x -> `SubstitutedMT (module_type map x)
8484+ | `SubstitutedMT x -> `SubstitutedMT (module_type map x)
8685 | `Identifier
8786 (({ iv = #Odoc_model.Paths.Identifier.ModuleType.t_pv; _ } as y), b) ->
8887 `Identifier (y, b)
8989- | `Local (id, b) ->
8888+ | `LocalModTy (`Na _) -> .
8989+ | `LocalModTy (#Ident.module_type as id) ->
9090 `Identifier
9191 ( (try Component.ModuleTypeMap.find id map.module_type
9292 with Not_found ->
9393 failwith (Format.asprintf "Not_found: %a" Ident.fmt id)),
9494- b )
9494+ false )
9595 | `Resolved x -> `Resolved (resolved_module_type map x)
9696 | `DotMT (p, n) -> `DotMT (module_ map p, n)
9797- | `ModuleType (`Module p, n) -> `DotMT (`Resolved (resolved_module map p), n)
9898- | `ModuleType (_, _) -> failwith "Probably shouldn't happen"
9797+ | `ModuleType (_, `Module p, n) -> `DotMT (`Resolved (resolved_module map p), n)
9898+ | `ModuleType (_, _, _) -> failwith "Probably shouldn't happen"
9999100100 and type_ map (p : Cpath.type_) : Odoc_model.Paths.Path.Type.t =
101101 match p with
102102- | `Substituted x -> `SubstitutedT (type_ map x)
102102+ | `SubstitutedT x -> `SubstitutedT (type_ map x)
103103+ | `SubstitutedCT x -> `SubstitutedCT (class_type map x)
103104 | `Identifier
104105 (({ iv = #Odoc_model.Paths.Identifier.Path.Type.t_pv; _ } as y), b) ->
105106 `Identifier (y, b)
106106- | `Local (id, b) -> `Identifier (Component.TypeMap.find id map.path_type, b)
107107+ | `LocalTy (`Na _) -> .
108108+ | `LocalTy (#Ident.type_ as id) -> `Identifier (Component.TypeMap.find id map.path_type, false)
107109 | `Resolved x -> `Resolved (resolved_type map x)
108110 | `DotT (p, n) -> `DotT (module_ map p, n)
109109- | `Type (`Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
110110- | `Class (`Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
111111- | `ClassType (`Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
112112- | `Type _ | `Class _ | `ClassType _ -> failwith "Probably shouldn't happen"
111111+ | `Type (_, `Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
112112+ | `Type (_, _, _) -> failwith "Probably shouldn't happen"
113113114114 and class_type map (p : Cpath.class_type) : Odoc_model.Paths.Path.ClassType.t
115115 =
116116 match p with
117117- | `Substituted x -> `SubstitutedCT (class_type map x)
117117+ | `SubstitutedCT x -> `SubstitutedCT (class_type map x)
118118 | `Identifier
119119 (({ iv = #Odoc_model.Paths.Identifier.Path.ClassType.t_pv; _ } as y), b)
120120 ->
121121 `Identifier (y, b)
122122- | `Local (id, b) ->
123123- `Identifier (Component.TypeMap.find id map.path_class_type, b)
122122+ | `LocalTy (`Na _) -> .
123123+ | `LocalTy (#Ident.type_ as id) ->
124124+ `Identifier (Component.TypeMap.find id map.path_class_type, false)
124125 | `Resolved x -> `Resolved (resolved_class_type map x)
125126 | `DotT (p, n) -> `DotT (module_ map p, n)
126126- | `Class (`Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
127127- | `ClassType (`Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
128128- | `Class _ | `ClassType _ -> failwith "Probably shouldn't happen"
127127+ | `Type (_, `Module p, n) -> `DotT (`Resolved (resolved_module map p), n)
128128+ | `Type (_, _, _) -> failwith "Probably shouldn't happen"
129129130130 and resolved_module map (p : Cpath.Resolved.module_) :
131131 Odoc_model.Paths.Path.Resolved.Module.t =
132132 match p with
133133- | `Local id ->
133133+ | `LocalMod (`Na _) -> .
134134+ | `LocalMod (#Ident.module_ as id) ->
134135 `Identifier
135136 (try lookup_module map id
136137 with Not_found ->
137138 failwith (Format.asprintf "Not_found: %a" Ident.fmt id))
138139 | `Substituted x -> `Substituted (resolved_module map x)
139139- | `Gpath y -> y
140140+ | `Identifier y -> `Identifier y
140141 | `Subst (mty, m) ->
141142 `Subst (resolved_module_type map mty, resolved_module map m)
142143 | `Hidden h -> `Hidden (resolved_module map h)
143144 | `Module (p, n) -> `Module (resolved_parent map p, n)
144144- | `Canonical (r, m) -> `Canonical (resolved_module map r, m)
145145+ | `Canonical (r, m) -> `Canonical (resolved_module map r, module_ map m)
145146 | `Apply (m1, m2) -> `Apply (resolved_module map m1, resolved_module map m2)
146146- | `Alias (m1, m2, _) -> `Alias (resolved_module map m1, module_ map m2)
147147+ | `Alias (m1, m2, m3opt) ->
148148+ let m3opt' = match m3opt with
149149+ | Some m3 -> Some (resolved_module map m3)
150150+ | None -> None
151151+ in
152152+ `Alias (resolved_module map m1, module_ map m2, m3opt')
147153 | `OpaqueModule m -> `OpaqueModule (resolved_module map m)
148154149149- and resolved_parent map (p : Cpath.Resolved.parent) =
155155+ and resolved_parent map (p : Cpath.Resolved.parent) :
156156+ Odoc_model.Paths.Path.Resolved.parent =
150157 match p with
151151- | `Module m -> resolved_module map m
152152- | `ModuleType _ -> failwith "Invalid"
153153- | `FragmentRoot -> (
158158+ | `Module m -> `Module (resolved_module map m)
159159+ | `ModuleType (_, `U) -> failwith "Invalid"
160160+ | `FragmentRoot `U -> (
154161 match map.fragment_root with
155155- | Some r -> resolved_parent map (r :> Cpath.Resolved.parent)
162162+ | Some (`Module m) -> resolved_parent map (`Module m)
163163+ | Some (`ModuleType m) -> resolved_parent map (`ModuleType (m, `U))
156164 | None -> failwith "Invalid")
165165+ | `ModuleType (_, `Na _) -> .
166166+ | `FragmentRoot (`Na _) -> .
157167158168 and resolved_module_type map (p : Cpath.Resolved.module_type) :
159169 Odoc_model.Paths.Path.Resolved.ModuleType.t =
160170 match p with
161161- | `Gpath y -> y
162162- | `Local id ->
171171+ | `Identifier y -> `Identifier y
172172+ | `LocalModTy (`Na _) -> .
173173+ | `LocalModTy (#Ident.module_type as id) ->
163174 `Identifier
164175 (try Component.ModuleTypeMap.find id map.module_type
165176 with Not_found ->
166177 failwith (Format.asprintf "Not_found: %a" Ident.fmt id))
167178 | `ModuleType (p, name) -> `ModuleType (resolved_parent map p, name)
168168- | `Substituted s -> `SubstitutedMT (resolved_module_type map s)
179179+ | `SubstitutedMT s -> `SubstitutedMT (resolved_module_type map s)
169180 | `SubstT (p1, p2) ->
170181 `SubstT (resolved_module_type map p1, resolved_module_type map p2)
171182 | `AliasModuleType (p1, p2) ->
172183 `AliasModuleType
173184 (resolved_module_type map p1, resolved_module_type map p2)
174185 | `CanonicalModuleType (p1, p2) ->
175175- `CanonicalModuleType (resolved_module_type map p1, p2)
186186+ `CanonicalModuleType (resolved_module_type map p1, module_type map p2)
176187 | `OpaqueModuleType m -> `OpaqueModuleType (resolved_module_type map m)
177188178189 and resolved_type map (p : Cpath.Resolved.type_) :
179190 Odoc_model.Paths.Path.Resolved.Type.t =
180191 match p with
181192 | `CoreType _ as c -> c
182182- | `Gpath y -> y
183183- | `Local id -> `Identifier (Component.TypeMap.find id map.path_type)
184184- | `CanonicalType (t1, t2) -> `CanonicalType (resolved_type map t1, t2)
193193+ | `Identifier y -> `Identifier y
194194+ | `LocalTy (`Na _) -> .
195195+ | `LocalTy (#Ident.type_ as id) -> `Identifier (Component.TypeMap.find id map.path_type)
196196+ | `CanonicalType (t1, t2) -> `CanonicalType (resolved_type map t1, type_ map t2)
185197 | `Type (p, name) -> `Type (resolved_parent map p, name)
186198 | `Class (p, name) -> `Class (resolved_parent map p, name)
187199 | `ClassType (p, name) -> `ClassType (resolved_parent map p, name)
188188- | `Substituted s -> `SubstitutedT (resolved_type map s)
200200+ | `SubstitutedT s -> `SubstitutedT (resolved_type map s)
201201+ | `SubstitutedCT s -> `SubstitutedCT (resolved_class_type map s)
189202190203 and resolved_value map (p : Cpath.Resolved.value) :
191204 Odoc_model.Paths.Path.Resolved.Value.t =
192205 match p with
193206 | `Value (p, name) -> `Value (resolved_parent map p, name)
194194- | `Gpath y -> y
207207+ | `Identifier y -> `Identifier y
208208+ | `LocalVal (`Na _) -> .
209209+ | `LocalVal (#Ident.value as _id) -> failwith "resolved_value: LocalVal"
195210196211 and resolved_class_type map (p : Cpath.Resolved.class_type) :
197212 Odoc_model.Paths.Path.Resolved.ClassType.t =
198213 match p with
199199- | `Gpath y -> y
200200- | `Local id -> `Identifier (Component.TypeMap.find id map.path_class_type)
214214+ | `Identifier y -> `Identifier y
215215+ | `LocalTy (`Na _) -> .
216216+ | `LocalTy (#Ident.type_ as id) -> `Identifier (Component.TypeMap.find id map.path_class_type)
201217 | `Class (p, name) -> `Class (resolved_parent map p, name)
202218 | `ClassType (p, name) -> `ClassType (resolved_parent map p, name)
203203- | `Substituted s -> `SubstitutedCT (resolved_class_type map s)
219219+ | `SubstitutedCT s -> `SubstitutedCT (resolved_class_type map s)
204220205221 let rec module_fragment :
206222 maps -> Cfrag.module_ -> Odoc_model.Paths.Fragment.Module.t =
+1-1
odoc/src/xref2/lang_of.mli
···22222323 val resolved_module : maps -> Cpath.Resolved.module_ -> Path.Resolved.Module.t
24242525- val resolved_parent : maps -> Cpath.Resolved.parent -> Path.Resolved.Module.t
2525+ val resolved_parent : maps -> Cpath.Resolved.parent -> Path.Resolved.parent
26262727 val resolved_module_type :
2828 maps -> Cpath.Resolved.module_type -> Path.Resolved.ModuleType.t
+21-8
odoc/src/xref2/link.ml
···8383 let self = (self :> Paths.Path.Resolved.t) in
8484 let hidden_alias = Paths.Path.Resolved.is_hidden self
8585 and self_canonical =
8686- let i = Paths.Path.Resolved.identifier self in
8787- i = Some (target :> Paths.Identifier.t)
8686+ match Paths.Path.Resolved.identifier self with
8787+ | Some i -> i = (target :> Paths.Identifier.t)
8888+ | None -> false
8889 in
89909091 self_canonical || hidden_alias
···99100 | `Dot (p, _) -> is_forward p
100101 | `Apply (p1, p2) -> is_forward p1 || is_forward p2
101102 | `Substituted s -> is_forward s
103103+ | `Module _ -> false
104104+ | `LocalMod (`Na _) -> .
102105103106let rec should_reresolve : Paths.Path.Resolved.t -> bool =
104107 fun p ->
···117120 | `Apply (x, y) ->
118121 should_reresolve (x :> t) || should_reresolve (y :> Paths.Path.Resolved.t)
119122 | `SubstT (x, y) -> should_reresolve (x :> t) || should_reresolve (y :> t)
120120- | `Alias (y, x) ->
123123+ | `Alias (y, x, _) ->
121124 should_resolve (x :> Paths.Path.t) || should_reresolve (y :> t)
122125 | `AliasModuleType (x, y) ->
123126 should_reresolve (x :> t) || should_reresolve (y :> t)
···126129 | `Class (p, _)
127130 | `ClassType (p, _)
128131 | `ModuleType (p, _)
129129- | `Module (p, _) ->
130130- should_reresolve (p :> t)
132132+ | `Module (p, _) -> (
133133+ match p with
134134+ | `Module m -> should_reresolve (m :> t)
135135+ | `ModuleType (_, `Na _) -> .
136136+ | `FragmentRoot (`Na _) -> .)
131137 | `OpaqueModule m -> should_reresolve (m :> t)
132138 | `OpaqueModuleType m -> should_reresolve (m :> t)
133139 | `Substituted m -> should_reresolve (m :> t)
134140 | `SubstitutedMT m -> should_reresolve (m :> t)
135141 | `SubstitutedT m -> should_reresolve (m :> t)
136142 | `SubstitutedCT m -> should_reresolve (m :> t)
143143+ | `LocalMod (`Na _) -> .
144144+ | `LocalModTy (`Na _) -> .
145145+ | `LocalTy (`Na _) -> .
146146+ | `LocalVal (`Na _) -> .
137147138148and should_resolve : Paths.Path.t -> bool =
139149 fun p -> match p with `Resolved p -> should_reresolve p | _ -> true
···10311041 match equation.Equation.manifest with
10321042 | Some (Constr (`Resolved path, params))
10331043 when Paths.Path.Resolved.(is_hidden (path :> t))
10341034- || Paths.Path.Resolved.(identifier (path :> t))
10351035- = Some (t.id :> Paths.Identifier.t) ->
10441044+ || (match path with
10451045+ | `CoreType _ -> false
10461046+ | _ ->
10471047+ Paths.Path.Resolved.(identifier (path :> t))
10481048+ = Some (t.id :> Paths.Identifier.t)) ->
10361049 Some (path, params)
10371050 | _ -> None
10381051 in
···11801193 let cp' = Tools.reresolve_type env cp' in
11811194 let p = Lang_of.(Path.resolved_type (empty ()) cp') in
11821195 if List.mem p visited then raise Loop
11831183- else if Cpath.is_resolved_type_hidden cp' then
11961196+ else if Cpath.is_resolved_hidden ~weak_canonical_test:false (cp' :> Cpath.Resolved.any) then
11841197 match t.Component.TypeDecl.equation with
11851198 | { manifest = Some expr; params; _ } -> (
11861199 try
+3-3
odoc/src/xref2/ref_tools.ml
···167167 Tools.expansion_of_module_type env m
168168 |> map_error (fun e -> `Parent (`Parent_sig e))
169169 >>= Tools.assert_not_functor
170170- >>= fun sg -> Ok ((ref :> Resolved.Signature.t), `ModuleType cp, sg)
170170+ >>= fun sg -> Ok ((ref :> Resolved.Signature.t), `ModuleType (cp, `U), sg)
171171172172let type_lookup_to_class_signature_lookup =
173173 let resolved p' cs = Ok ((p' :> Resolved.ClassSignature.t), cs) in
···216216 let of_element env (`Module (id, m)) : t =
217217 let m = Component.Delayed.get m in
218218 let id = (id :> Identifier.Path.Module.t) in
219219- of_component env m (`Gpath (`Identifier id)) (`Identifier id)
219219+ of_component env m (`Identifier id) (`Identifier id)
220220221221 let in_env env name =
222222 match env_lookup_by_name Env.s_module name env with
···287287 (`ModuleType (parent', name)))
288288289289 let of_element env (`ModuleType (id, mt)) : t =
290290- of_component env mt (`Gpath (`Identifier id)) (`Identifier id)
290290+ of_component env mt (`Identifier id) (`Identifier id)
291291292292 let in_env env name =
293293 env_lookup_by_name Env.s_module_type name env >>= fun e ->
+69-33
odoc/src/xref2/shape_tools.cppo.ml
···8585 shape_of_id env (id :> Odoc_model.Paths.Identifier.NonSrc.t)
8686 | `Substituted m ->
8787 shape_of_module_path env m
8888+ | `Module _ | `LocalMod _ -> None
88898990let rec shape_of_kind_path env kind :
9091 Odoc_model.Paths.Path.t -> Shape.t option =
···108109 | `Forward _
109110 | `Dot _
110111 | `Root _
111111- | `Apply _ -> None
112112+ | `Apply _
113113+ | `Module _
114114+ | `LocalMod _
115115+ | `LocalTy _
116116+ | `ModuleType _
117117+ | `LocalModTy _
118118+ | `Type _
119119+ | `LocalVal _ -> None
112120113121module MkId = Identifier.Mk
114122···130138 | _ -> None
131139#endif
132140141141+(* Cache the per-env shape reducer. [Shape_reduce.Make] allocates a lot of
142142+ internal hashtables; we only want to do that once per env. Since the same
143143+ env is used for a whole link traversal, caching by physical equality on
144144+ env hits almost every call. *)
145145+type cached_reduce_t = {
146146+ env : Env.t;
147147+#if OCAML_VERSION < (5,2,0)
148148+ reducer : Shape.t -> Shape.reduction_result;
149149+#else
150150+ reducer : Shape.t -> Shape_reduce.result;
151151+#endif
152152+}
153153+154154+let cached_reduce : cached_reduce_t option ref = ref None
155155+156156+let get_reducer env =
157157+ match !cached_reduce with
158158+ | Some c when c.env == env -> c.reducer
159159+ | _ ->
160160+#if OCAML_VERSION < (5,2,0)
161161+ let module Reduce = Shape.Make_reduce (struct
162162+ type env = unit
163163+ let fuel = 10
164164+ let read_unit_shape ~unit_name =
165165+ match Env.lookup_impl unit_name env with
166166+ | Some impl -> (
167167+ match impl.shape_info with
168168+ | Some (shape, _) -> Some shape
169169+ | None -> None)
170170+ | _ -> None
171171+ let find_shape _ _ = raise Not_found
172172+ end) in
173173+ let reducer query = Reduce.reduce () query in
174174+#else
175175+ let module Reduce = Shape_reduce.Make(struct
176176+ let fuel = 10
177177+ let read_unit_shape ~unit_name =
178178+ match Env.lookup_impl unit_name env with
179179+ | Some impl -> (
180180+ match impl.shape_info with
181181+ | Some (shape, _) -> Some shape
182182+ | None -> None)
183183+ | _ -> None
184184+#if defined OXCAML
185185+ let fuel () = Misc.Maybe_bounded.of_int fuel
186186+ let projection_rules_for_merlin_enabled = false
187187+ let fuel_for_compilation_units = fuel
188188+ let max_shape_reduce_steps_per_variable = fuel
189189+ let max_compilation_unit_depth = fuel
190190+ let read_unit_shape ~diagnostics:_ ~unit_name = read_unit_shape ~unit_name
191191+#endif
192192+ end) in
193193+ let reducer query = Reduce.reduce_for_uid Ocaml_env.empty query in
194194+#endif
195195+ cached_reduce := Some { env; reducer };
196196+ reducer
197197+133198let lookup_shape : Env.t -> Shape.t -> Identifier.SourceLocation.t option =
134199 fun env query ->
200200+ let reducer = get_reducer env in
135201#if OCAML_VERSION < (5,2,0)
136136- let module Reduce = Shape.Make_reduce (struct
137137- type env = unit
138138- let fuel = 10
139139- let read_unit_shape ~unit_name =
140140- match Env.lookup_impl unit_name env with
141141- | Some impl -> (
142142- match impl.shape_info with
143143- | Some (shape, _) -> Some shape
144144- | None -> None)
145145- | _ -> None
146146- let find_shape _ _ = raise Not_found
147147- end) in
148148- let result = try Some (Reduce.reduce () query) with Not_found -> None in
202202+ let result = try Some (reducer query) with Not_found -> None in
149203 result >>= fun result ->
150204 result.uid >>= fun uid ->
151205#else
152152- let module Reduce = Shape_reduce.Make(struct
153153- let fuel = 10
154154- let read_unit_shape ~unit_name =
155155- match Env.lookup_impl unit_name env with
156156- | Some impl -> (
157157- match impl.shape_info with
158158- | Some (shape, _) -> Some shape
159159- | None -> None)
160160- | _ -> None
161161-#if defined OXCAML
162162- let fuel () = Misc.Maybe_bounded.of_int fuel
163163- let projection_rules_for_merlin_enabled = false
164164- let fuel_for_compilation_units = fuel
165165- let max_shape_reduce_steps_per_variable = fuel
166166- let max_compilation_unit_depth = fuel
167167- let read_unit_shape ~diagnostics:_ ~unit_name = read_unit_shape ~unit_name
168168-#endif
169169- end) in
170170- let result = try Some (Reduce.reduce_for_uid Ocaml_env.empty query) with Not_found -> None in
206206+ let result = try Some (reducer query) with Not_found -> None in
171207 result >>= traverse_aliases >>= fun uid ->
172208#endif
173209 unit_of_uid uid >>= fun unit_name ->
+747-430
odoc/src/xref2/subst.ml
···2929 unresolve_opaque_paths = false;
3030 }
31313232+let is_identity s =
3333+ ModuleMap.is_empty s.module_
3434+ && ModuleTypeMap.is_empty s.module_type
3535+ && ModuleTypeMap.is_empty s.module_type_replacement
3636+ && TypeMap.is_empty s.type_
3737+ && TypeMap.is_empty s.class_type
3838+ && TypeMap.is_empty s.type_replacement
3939+ && s.path_invalidating_modules = []
4040+ && not s.unresolve_opaque_paths
4141+3242let pp fmt s =
3343 let pp_map pp_binding b fmt map =
3444 let pp_b fmt (id, v) =
···209219 t -> Cpath.Resolved.module_ -> Cpath.Resolved.module_ =
210220 fun s p ->
211221 match p with
212212- | `Local id -> (
222222+ | `LocalMod (`Na _) -> .
223223+ | `LocalMod (#Ident.module_ as id) -> (
213224 if List.mem id s.path_invalidating_modules then raise Invalidated;
214225 match
215215- try Some (ModuleMap.find (id :> Ident.module_) s.module_)
226226+ try Some (ModuleMap.find id s.module_)
216227 with _ -> None
217228 with
218218- | Some (`Renamed x) -> `Local x
229229+ | Some (`Renamed x) -> `LocalMod (x :> Cpath.lmod)
219230 | Some (`Prefixed (_p, rp)) -> rp
220231 | Some `Substituted -> `Substituted p
221232 | None -> p)
222222- | `Gpath _ -> p
233233+ | `Identifier _ -> p
223234 | `Apply (p1, p2) ->
224224- `Apply (resolved_module_path s p1, resolved_module_path s p2)
225225- | `Substituted p -> `Substituted (resolved_module_path s p)
226226- | `Module (p, n) -> `Module (resolved_parent_path s p, n)
235235+ let p1' = resolved_module_path s p1 in
236236+ let p2' = resolved_module_path s p2 in
237237+ if p1' == p1 && p2' == p2 then p
238238+ else `Apply (p1', p2')
239239+ | `Substituted m ->
240240+ let m' = resolved_module_path s m in
241241+ if m' == m then p else `Substituted m'
242242+ | `Module (parent, n) ->
243243+ let parent' = resolved_parent_path s parent in
244244+ if parent' == parent then p else `Module (parent', n)
227245 | `Alias (p1, p2, p3opt) ->
246246+ let p1' = resolved_module_path s p1 in
228247 let p2' = module_path s p2 in
229248 let up2' = try Cpath.unresolve_module_path p2' with _ -> p2' in
230249 let p3opt' =
···232251 | Some p3 -> Some (resolved_module_path s p3)
233252 | None -> None
234253 in
235235- `Alias (resolved_module_path s p1, up2', p3opt')
254254+ if p1' == p1 && up2' == p2 && p3opt' == p3opt then p
255255+ else `Alias (p1', up2', p3opt')
236256 | `Subst (p1, p2) ->
237237- let p1 =
257257+ let p1' =
238258 match resolved_module_type_path s p1 with
239239- | Replaced _ ->
240240- (* the left hand side of Subst is a named module type inside a module,
241241- it cannot be substituted away *)
242242- assert false
243243- | Not_replaced p1 -> p1
259259+ | Replaced _ -> assert false
260260+ | Not_replaced p1' -> p1'
244261 in
245245- `Subst (p1, resolved_module_path s p2)
246246- | `Hidden p1 -> `Hidden (resolved_module_path s p1)
247247- | `Canonical (p1, p2) -> `Canonical (resolved_module_path s p1, p2)
262262+ let p2' = resolved_module_path s p2 in
263263+ if p1' == p1 && p2' == p2 then p else `Subst (p1', p2')
264264+ | `Hidden p1 ->
265265+ let p1' = resolved_module_path s p1 in
266266+ if p1' == p1 then p else `Hidden p1'
267267+ | `Canonical (p1, p2) ->
268268+ let p1' = resolved_module_path s p1 in
269269+ if p1' == p1 then p else `Canonical (p1', p2)
248270 | `OpaqueModule m ->
249271 if s.unresolve_opaque_paths then raise Invalidated
250250- else `OpaqueModule (resolved_module_path s m)
272272+ else
273273+ let m' = resolved_module_path s m in
274274+ if m' == m then p else `OpaqueModule m'
251275252252-and resolved_parent_path s = function
253253- | `Module m -> `Module (resolved_module_path s m)
254254- | `ModuleType m ->
255255- let p =
256256- match resolved_module_type_path s m with
257257- | Replaced _ -> assert false
258258- | Not_replaced p1 -> p1
259259- in
260260- `ModuleType p
261261- | `FragmentRoot as x -> x
276276+and resolved_parent_path s p =
277277+ match p with
278278+ | `Module m ->
279279+ let m' = resolved_module_path s m in
280280+ if m' == m then p else `Module m'
281281+ | `ModuleType (m, `U) -> (
282282+ match resolved_module_type_path s m with
283283+ | Replaced _ -> assert false
284284+ | Not_replaced m' ->
285285+ if m' == m then p else `ModuleType (m', `U))
286286+ | `FragmentRoot `U -> p
287287+ | `ModuleType (_, `Na _) -> .
288288+ | `FragmentRoot (`Na _) -> .
262289263290and module_path : t -> Cpath.module_ -> Cpath.module_ =
264291 fun s p ->
265292 match p with
266293 | `Resolved p' -> (
267267- try `Resolved (resolved_module_path s p')
294294+ try
295295+ let p'' = resolved_module_path s p' in
296296+ if p'' == p' then p else `Resolved p''
268297 with Invalidated ->
269298 let path' = Cpath.unresolve_resolved_module_path p' in
270299 module_path s path')
271271- | `Dot (p', str) -> `Dot (module_path s p', str)
272272- | `Module (p', str) -> `Module (resolved_parent_path s p', str)
273273- | `Apply (p1, p2) -> `Apply (module_path s p1, module_path s p2)
274274- | `Local (id, b) -> (
300300+ | `Dot (p', str) ->
301301+ let p'' = module_path s p' in
302302+ if p'' == p' then p else `Dot (p'', str)
303303+ | `Module (_, p', str) -> `Module (`U, resolved_parent_path s p', str)
304304+ | `Apply (p1, p2) ->
305305+ let p1' = module_path s p1 in
306306+ let p2' = module_path s p2 in
307307+ if p1' == p1 && p2' == p2 then p else `Apply (p1', p2')
308308+ | `LocalMod (`Na _) -> .
309309+ | `LocalMod (#Ident.module_ as id) -> (
275310 match
276276- try Some (ModuleMap.find (id :> Ident.module_) s.module_)
311311+ try Some (ModuleMap.find id s.module_)
277312 with _ -> None
278313 with
279314 | Some (`Prefixed (p, _rp)) -> p
280280- | Some (`Renamed x) -> `Local (x, b)
315315+ | Some (`Renamed x) -> `LocalMod (x :> Cpath.lmod)
281316 | Some `Substituted -> `Substituted p
282282- | None -> `Local (id, b))
317317+ | None -> p)
283318 | `Identifier _ -> p
284284- | `Substituted p -> `Substituted (module_path s p)
319319+ | `Substituted m ->
320320+ let m' = module_path s m in
321321+ if m' == m then p else `Substituted m'
285322 | `Forward _ -> p
286323 | `Root _ -> p
287324···291328 (Cpath.Resolved.module_type, ModuleType.expr) or_replaced =
292329 fun s p ->
293330 match p with
294294- | `Local id -> (
331331+ | `LocalModTy (`Na _) -> .
332332+ | `LocalModTy (#Ident.module_type as id) -> (
295333 if ModuleTypeMap.mem id s.module_type_replacement then
296334 Replaced (ModuleTypeMap.find id s.module_type_replacement)
297335 else
298336 match ModuleTypeMap.find id s.module_type with
299337 | `Prefixed (_p, rp) -> Not_replaced rp
300300- | `Renamed x -> Not_replaced (`Local x)
301301- | exception Not_found -> Not_replaced (`Local id))
302302- | `Gpath _ -> Not_replaced p
303303- | `Substituted p ->
304304- resolved_module_type_path s p |> map_replaced (fun p -> `Substituted p)
305305- | `ModuleType (p, n) ->
306306- Not_replaced (`ModuleType (resolved_parent_path s p, n))
338338+ | `Renamed x -> Not_replaced (`LocalModTy (x :> Cpath.lmodty))
339339+ | exception Not_found -> Not_replaced (`LocalModTy (id :> Cpath.lmodty)))
340340+ | `Identifier _ -> Not_replaced p
341341+ | `SubstitutedMT m -> (
342342+ match resolved_module_type_path s m with
343343+ | Not_replaced m' ->
344344+ if m' == m then Not_replaced p else Not_replaced (`SubstitutedMT m')
345345+ | Replaced _ as r -> r)
346346+ | `ModuleType (parent, n) ->
347347+ let parent' = resolved_parent_path s parent in
348348+ if parent' == parent then Not_replaced p
349349+ else Not_replaced (`ModuleType (parent', n))
307350 | `CanonicalModuleType (mt1, mt2) -> (
308351 match resolved_module_type_path s mt1 with
309309- | Not_replaced mt1' -> Not_replaced (`CanonicalModuleType (mt1', mt2))
352352+ | Not_replaced mt1' ->
353353+ if mt1' == mt1 then Not_replaced p
354354+ else Not_replaced (`CanonicalModuleType (mt1', mt2))
310355 | x -> x)
311356 | `OpaqueModuleType m ->
312357 if s.unresolve_opaque_paths then raise Invalidated
313313- else
314314- resolved_module_type_path s m
315315- |> map_replaced (fun x -> `OpaqueModuleType x)
358358+ else (
359359+ match resolved_module_type_path s m with
360360+ | Not_replaced m' ->
361361+ if m' == m then Not_replaced p
362362+ else Not_replaced (`OpaqueModuleType m')
363363+ | Replaced _ as r -> r)
316364 | `SubstT (p1, p2) -> (
317365 match
318366 (resolved_module_type_path s p1, resolved_module_type_path s p2)
319367 with
320320- | Not_replaced p1, Not_replaced p2 -> Not_replaced (`SubstT (p1, p2))
368368+ | Not_replaced p1', Not_replaced p2' ->
369369+ if p1' == p1 && p2' == p2 then Not_replaced p
370370+ else Not_replaced (`SubstT (p1', p2'))
321371 | Replaced mt, _ | _, Replaced mt -> Replaced mt)
322372 | `AliasModuleType (p1, p2) -> (
323373 match
324374 (resolved_module_type_path s p1, resolved_module_type_path s p2)
325375 with
326326- | Not_replaced p1, Not_replaced p2 ->
327327- Not_replaced (`AliasModuleType (p1, p2))
376376+ | Not_replaced p1', Not_replaced p2' ->
377377+ if p1' == p1 && p2' == p2 then Not_replaced p
378378+ else Not_replaced (`AliasModuleType (p1', p2'))
328379 | Replaced mt, _ | _, Replaced mt -> Replaced mt)
329380330381and module_type_path :
···332383 fun s p ->
333384 match p with
334385 | `Resolved r -> (
335335- try resolved_module_type_path s r |> map_replaced (fun r -> `Resolved r)
386386+ try
387387+ match resolved_module_type_path s r with
388388+ | Not_replaced r' ->
389389+ if r' == r then Not_replaced p
390390+ else Not_replaced (`Resolved r')
391391+ | Replaced _ as x -> x
336392 with Invalidated ->
337393 let path' = Cpath.unresolve_resolved_module_type_path r in
338394 module_type_path s path')
339339- | `Substituted p ->
340340- module_type_path s p |> map_replaced (fun r -> `Substituted r)
341341- | `Local (id, b) ->
395395+ | `SubstitutedMT m -> (
396396+ match module_type_path s m with
397397+ | Not_replaced m' ->
398398+ if m' == m then Not_replaced p
399399+ else Not_replaced (`SubstitutedMT m')
400400+ | Replaced _ as r -> r)
401401+ | `LocalModTy (`Na _) -> .
402402+ | `LocalModTy (#Ident.module_type as id) ->
342403 if ModuleTypeMap.mem id s.module_type_replacement then
343404 Replaced (ModuleTypeMap.find id s.module_type_replacement)
344405 else
···347408 try Some (ModuleTypeMap.find id s.module_type) with _ -> None
348409 with
349410 | Some (`Prefixed (p, _rp)) -> p
350350- | Some (`Renamed x) -> `Local (x, b)
351351- | None -> `Local (id, b)
411411+ | Some (`Renamed x) -> `LocalModTy (x :> Cpath.lmodty)
412412+ | None -> p
352413 in
353414 Not_replaced r
354415 | `Identifier _ -> Not_replaced p
355355- | `DotMT (p, n) -> Not_replaced (`DotMT (module_path s p, n))
356356- | `ModuleType (p', str) ->
357357- Not_replaced (`ModuleType (resolved_parent_path s p', str))
416416+ | `DotMT (m, n) ->
417417+ let m' = module_path s m in
418418+ if m' == m then Not_replaced p
419419+ else Not_replaced (`DotMT (m', n))
420420+ | `ModuleType (_, p', str) ->
421421+ Not_replaced (`ModuleType (`U, resolved_parent_path s p', str))
358422359423and resolved_type_path :
360424 t ->
···362426 (Cpath.Resolved.type_, TypeExpr.t * TypeDecl.Equation.t) or_replaced =
363427 fun s p ->
364428 match p with
365365- | `CoreType _ as c -> Not_replaced c
366366- | `Local id -> (
429429+ | `CoreType _ -> Not_replaced p
430430+ | `LocalTy (`Na _) -> .
431431+ | `LocalTy (#Ident.type_ as id) -> (
367432 if TypeMap.mem id s.type_replacement then
368433 Replaced (TypeMap.find id s.type_replacement)
369434 else
370435 match try Some (TypeMap.find id s.type_) with Not_found -> None with
371436 | Some (`Prefixed (_p, rp)) -> Not_replaced rp
372372- | Some (`Renamed x) -> Not_replaced (`Local x)
373373- | None -> Not_replaced (`Local id))
437437+ | Some (`Renamed x) -> Not_replaced (`LocalTy (x :> Cpath.lty))
438438+ | None -> Not_replaced (`LocalTy (id :> Cpath.lty)))
374439 | `CanonicalType (t1, t2) -> (
375440 match resolved_type_path s t1 with
376376- | Not_replaced t1' -> Not_replaced (`CanonicalType (t1', t2))
441441+ | Not_replaced t1' ->
442442+ if t1' == t1 then Not_replaced p
443443+ else Not_replaced (`CanonicalType (t1', t2))
377444 | x -> x)
378378- | `Gpath _ -> Not_replaced p
379379- | `Substituted p ->
380380- resolved_type_path s p |> map_replaced (fun p -> `Substituted p)
381381- | `Type (p, n) -> Not_replaced (`Type (resolved_parent_path s p, n))
382382- | `ClassType (p, n) -> Not_replaced (`ClassType (resolved_parent_path s p, n))
383383- | `Class (p, n) -> Not_replaced (`Class (resolved_parent_path s p, n))
445445+ | `Identifier _ -> Not_replaced p
446446+ | `SubstitutedT m -> (
447447+ match resolved_type_path s m with
448448+ | Not_replaced m' ->
449449+ if m' == m then Not_replaced p else Not_replaced (`SubstitutedT m')
450450+ | Replaced _ as r -> r)
451451+ | `SubstitutedCT m ->
452452+ let m' = resolved_class_type_path s m in
453453+ if m' == m then Not_replaced p
454454+ else Not_replaced (`SubstitutedCT m')
455455+ | `Type (parent, n) ->
456456+ let parent' = resolved_parent_path s parent in
457457+ if parent' == parent then Not_replaced p
458458+ else Not_replaced (`Type (parent', n))
459459+ | `ClassType (parent, n) ->
460460+ let parent' = resolved_parent_path s parent in
461461+ if parent' == parent then Not_replaced p
462462+ else Not_replaced (`ClassType (parent', n))
463463+ | `Class (parent, n) ->
464464+ let parent' = resolved_parent_path s parent in
465465+ if parent' == parent then Not_replaced p
466466+ else Not_replaced (`Class (parent', n))
384467385468and type_path : t -> Cpath.type_ -> Cpath.type_ type_or_replaced =
386469 fun s p ->
387470 match p with
388471 | `Resolved r -> (
389389- try resolved_type_path s r |> map_replaced (fun r -> `Resolved r)
472472+ try
473473+ match resolved_type_path s r with
474474+ | Not_replaced r' ->
475475+ if r' == r then Not_replaced p
476476+ else Not_replaced (`Resolved r')
477477+ | Replaced _ as x -> x
390478 with Invalidated ->
391479 let path' = Cpath.unresolve_resolved_type_path r in
392480 type_path s path')
393393- | `Substituted p -> type_path s p |> map_replaced (fun r -> `Substituted r)
394394- | `Local (id, b) -> (
481481+ | `SubstitutedT m -> (
482482+ match type_path s m with
483483+ | Not_replaced m' ->
484484+ if m' == m then Not_replaced p
485485+ else Not_replaced (`SubstitutedT m')
486486+ | Replaced _ as r -> r)
487487+ | `SubstitutedCT m ->
488488+ let m' = class_type_path s m in
489489+ if m' == m then Not_replaced p
490490+ else Not_replaced (`SubstitutedCT m')
491491+ | `LocalTy (`Na _) -> .
492492+ | `LocalTy (#Ident.type_ as id) -> (
395493 if TypeMap.mem id s.type_replacement then
396494 Replaced (TypeMap.find id s.type_replacement)
397495 else
398496 match try Some (TypeMap.find id s.type_) with Not_found -> None with
399497 | Some (`Prefixed (p, _rp)) -> Not_replaced p
400400- | Some (`Renamed x) -> Not_replaced (`Local (x, b))
401401- | None -> Not_replaced (`Local (id, b)))
498498+ | Some (`Renamed x) -> Not_replaced (`LocalTy (x :> Cpath.lty))
499499+ | None -> Not_replaced p)
402500 | `Identifier _ -> Not_replaced p
403403- | `DotT (p, n) -> Not_replaced (`DotT (module_path s p, n))
404404- | `Type (p, n) -> Not_replaced (`Type (resolved_parent_path s p, n))
405405- | `Class (p, n) -> Not_replaced (`Class (resolved_parent_path s p, n))
406406- | `ClassType (p, n) -> Not_replaced (`ClassType (resolved_parent_path s p, n))
501501+ | `DotT (m, n) ->
502502+ let m' = module_path s m in
503503+ if m' == m then Not_replaced p
504504+ else Not_replaced (`DotT (m', n))
505505+ | `Type (_, p', n) -> Not_replaced (`Type (`U, resolved_parent_path s p', n))
407506408507and resolved_class_type_path :
409508 t -> Cpath.Resolved.class_type -> Cpath.Resolved.class_type =
410509 fun s p ->
411510 match p with
412412- | `Local id -> (
511511+ | `LocalTy (`Na _) -> .
512512+ | `LocalTy (#Ident.type_ as id) -> (
413513 match try Some (TypeMap.find id s.class_type) with _ -> None with
414514 | Some (`Prefixed (_p, rp)) -> rp
415415- | Some (`Renamed x) -> `Local x
416416- | None -> `Local id)
417417- | `Gpath _ -> p
418418- | `Substituted p -> `Substituted (resolved_class_type_path s p)
419419- | `ClassType (p, n) -> `ClassType (resolved_parent_path s p, n)
420420- | `Class (p, n) -> `Class (resolved_parent_path s p, n)
515515+ | Some (`Renamed x) -> `LocalTy (x :> Cpath.lty)
516516+ | None -> `LocalTy (id :> Cpath.lty))
517517+ | `Identifier _ -> p
518518+ | `SubstitutedCT m ->
519519+ let m' = resolved_class_type_path s m in
520520+ if m' == m then p else `SubstitutedCT m'
521521+ | `ClassType (parent, n) ->
522522+ let parent' = resolved_parent_path s parent in
523523+ if parent' == parent then p else `ClassType (parent', n)
524524+ | `Class (parent, n) ->
525525+ let parent' = resolved_parent_path s parent in
526526+ if parent' == parent then p else `Class (parent', n)
421527422528and class_type_path : t -> Cpath.class_type -> Cpath.class_type =
423529 fun s p ->
424530 match p with
425531 | `Resolved r -> (
426426- try `Resolved (resolved_class_type_path s r)
532532+ try
533533+ let r' = resolved_class_type_path s r in
534534+ if r' == r then p else `Resolved r'
427535 with Invalidated ->
428536 let path' = Cpath.unresolve_resolved_class_type_path r in
429537 class_type_path s path')
430430- | `Local (id, b) -> (
538538+ | `LocalTy (`Na _) -> .
539539+ | `LocalTy (#Ident.type_ as id) -> (
431540 match try Some (TypeMap.find id s.class_type) with _ -> None with
432541 | Some (`Prefixed (p, _rp)) -> p
433433- | Some (`Renamed x) -> `Local (x, b)
434434- | None -> `Local (id, b))
542542+ | Some (`Renamed x) -> `LocalTy (x :> Cpath.lty)
543543+ | None -> p)
435544 | `Identifier _ -> p
436436- | `Substituted p -> `Substituted (class_type_path s p)
437437- | `DotT (p, n) -> `DotT (module_path s p, n)
438438- | `Class (p, n) -> `Class (resolved_parent_path s p, n)
439439- | `ClassType (p, n) -> `ClassType (resolved_parent_path s p, n)
545545+ | `SubstitutedCT m ->
546546+ let m' = class_type_path s m in
547547+ if m' == m then p else `SubstitutedCT m'
548548+ | `DotT (m, n) ->
549549+ let m' = module_path s m in
550550+ if m' == m then p else `DotT (m', n)
551551+ | `Type (_, parent, n) -> `Type (`U, resolved_parent_path s parent, n)
440552441553let rec resolved_signature_fragment :
442554 t -> Cfrag.resolved_signature -> Cfrag.resolved_signature =
443555 fun t r ->
444556 match r with
445445- | `Root (`ModuleType p) ->
446446- let p =
447447- match resolved_module_type_path t p with
448448- | Not_replaced p -> p
449449- | Replaced _ ->
450450- (* The module type path was replaced by an expression. We can't keep
451451- it as a resolved fragment, so raise Invalidated to trigger
452452- unresolving. This can happen with OxCaml mode types. *)
453453- raise Invalidated
454454- in
455455- `Root (`ModuleType p)
456456- | `Root (`Module p) -> `Root (`Module (resolved_module_path t p))
557557+ | `Root (`ModuleType p) -> (
558558+ match resolved_module_type_path t p with
559559+ | Not_replaced p' ->
560560+ if p' == p then r else `Root (`ModuleType p')
561561+ | Replaced _ -> raise Invalidated)
562562+ | `Root (`Module p) ->
563563+ let p' = resolved_module_path t p in
564564+ if p' == p then r else `Root (`Module p')
457565 | (`Subst _ | `Alias _ | `OpaqueModule _ | `Module _) as x ->
458458- (resolved_module_fragment t x :> Cfrag.resolved_signature)
566566+ let x' = resolved_module_fragment t x in
567567+ if x' == x then r else (x' :> Cfrag.resolved_signature)
459568460569and resolved_module_fragment :
461570 t -> Cfrag.resolved_module -> Cfrag.resolved_module =
462571 fun t r ->
463572 match r with
464573 | `Subst (mty, f) ->
465465- let p =
574574+ let mty' =
466575 match resolved_module_type_path t mty with
467576 | Not_replaced p -> p
468468- | Replaced _ ->
469469- (* the left hand side of subst is a named module type inside a module,
470470- it cannot be substituted *)
471471- assert false
577577+ | Replaced _ -> assert false
472578 in
473473- `Subst (p, resolved_module_fragment t f)
579579+ let f' = resolved_module_fragment t f in
580580+ if mty' == mty && f' == f then r else `Subst (mty', f')
474581 | `Alias (m, f) ->
475475- `Alias (resolved_module_path t m, resolved_module_fragment t f)
476476- | `Module (sg, n) -> `Module (resolved_signature_fragment t sg, n)
477477- | `OpaqueModule m -> `OpaqueModule (resolved_module_fragment t m)
582582+ let m' = resolved_module_path t m in
583583+ let f' = resolved_module_fragment t f in
584584+ if m' == m && f' == f then r else `Alias (m', f')
585585+ | `Module (sg, n) ->
586586+ let sg' = resolved_signature_fragment t sg in
587587+ if sg' == sg then r else `Module (sg', n)
588588+ | `OpaqueModule m ->
589589+ let m' = resolved_module_fragment t m in
590590+ if m' == m then r else `OpaqueModule m'
478591479592and resolved_module_type_fragment :
480593 t -> Cfrag.resolved_module_type -> Cfrag.resolved_module_type =
481594 fun t r ->
482595 match r with
483483- | `ModuleType (s, n) -> `ModuleType (resolved_signature_fragment t s, n)
596596+ | `ModuleType (s, n) ->
597597+ let s' = resolved_signature_fragment t s in
598598+ if s' == s then r else `ModuleType (s', n)
484599485600and resolved_type_fragment : t -> Cfrag.resolved_type -> Cfrag.resolved_type =
486601 fun t r ->
487602 match r with
488488- | `Type (s, n) -> `Type (resolved_signature_fragment t s, n)
489489- | `ClassType (s, n) -> `ClassType (resolved_signature_fragment t s, n)
490490- | `Class (s, n) -> `Class (resolved_signature_fragment t s, n)
603603+ | `Type (s, n) ->
604604+ let s' = resolved_signature_fragment t s in
605605+ if s' == s then r else `Type (s', n)
606606+ | `ClassType (s, n) ->
607607+ let s' = resolved_signature_fragment t s in
608608+ if s' == s then r else `ClassType (s', n)
609609+ | `Class (s, n) ->
610610+ let s' = resolved_signature_fragment t s in
611611+ if s' == s then r else `Class (s', n)
491612492613let rec signature_fragment : t -> Cfrag.signature -> Cfrag.signature =
493614 fun t r ->
494615 match r with
495616 | `Resolved f -> (
496496- try `Resolved (resolved_signature_fragment t f)
617617+ try
618618+ let f' = resolved_signature_fragment t f in
619619+ if f' == f then r else `Resolved f'
497620 with Invalidated ->
498621 let frag' = Cfrag.unresolve_signature f in
499622 signature_fragment t frag')
500500- | `Dot (sg, n) -> `Dot (signature_fragment t sg, n)
501501- | `Root -> `Root
623623+ | `Dot (sg, n) ->
624624+ let sg' = signature_fragment t sg in
625625+ if sg' == sg then r else `Dot (sg', n)
626626+ | `Root -> r
502627503628let rec module_fragment : t -> Cfrag.module_ -> Cfrag.module_ =
504629 fun t r ->
505630 match r with
506506- | `Resolved r -> (
507507- try `Resolved (resolved_module_fragment t r)
631631+ | `Resolved f -> (
632632+ try
633633+ let f' = resolved_module_fragment t f in
634634+ if f' == f then r else `Resolved f'
508635 with Invalidated ->
509509- let frag' = Cfrag.unresolve_module r in
636636+ let frag' = Cfrag.unresolve_module f in
510637 module_fragment t frag')
511511- | `Dot (sg, n) -> `Dot (signature_fragment t sg, n)
638638+ | `Dot (sg, n) ->
639639+ let sg' = signature_fragment t sg in
640640+ if sg' == sg then r else `Dot (sg', n)
512641513642let rec module_type_fragment : t -> Cfrag.module_type -> Cfrag.module_type =
514643 fun t r ->
515644 match r with
516516- | `Resolved r -> (
517517- try `Resolved (resolved_module_type_fragment t r)
645645+ | `Resolved f -> (
646646+ try
647647+ let f' = resolved_module_type_fragment t f in
648648+ if f' == f then r else `Resolved f'
518649 with Invalidated ->
519519- let frag' = Cfrag.unresolve_module_type r in
650650+ let frag' = Cfrag.unresolve_module_type f in
520651 module_type_fragment t frag')
521521- | `Dot (sg, n) -> `Dot (signature_fragment t sg, n)
652652+ | `Dot (sg, n) ->
653653+ let sg' = signature_fragment t sg in
654654+ if sg' == sg then r else `Dot (sg', n)
522655523656let rec type_fragment : t -> Cfrag.type_ -> Cfrag.type_ =
524657 fun t r ->
525658 match r with
526526- | `Resolved r -> (
527527- try `Resolved (resolved_type_fragment t r)
659659+ | `Resolved f -> (
660660+ try
661661+ let f' = resolved_type_fragment t f in
662662+ if f' == f then r else `Resolved f'
528663 with Invalidated ->
529529- let frag' = Cfrag.unresolve_type r in
664664+ let frag' = Cfrag.unresolve_type f in
530665 type_fragment t frag')
531531- | `Dot (sg, n) -> `Dot (signature_fragment t sg, n)
666666+ | `Dot (sg, n) ->
667667+ let sg' = signature_fragment t sg in
668668+ if sg' == sg then r else `Dot (sg', n)
532669533670let option_ conv s x = match x with Some x -> Some (conv s x) | None -> None
534671535535-let list conv s xs = List.map (conv s) xs
672672+let option_sharing conv s x =
673673+ match x with
674674+ | None -> x
675675+ | Some v ->
676676+ let v' = conv s v in
677677+ if v' == v then x else Some v'
678678+679679+let list_sharing conv s xs =
680680+ let changed = ref false in
681681+ let ys = List.map (fun x ->
682682+ let y = conv s x in
683683+ if y != x then changed := true;
684684+ y
685685+ ) xs in
686686+ if !changed then ys else xs
687687+688688+let pair_sharing conv1 conv2 s ((a, b) as p) =
689689+ let a' = conv1 s a in
690690+ let b' = conv2 s b in
691691+ if a' == a && b' == b then p else (a', b')
536692537693let rec type_ s t =
538694 let open Component.TypeDecl in
539539- let representation = option_ type_decl_representation s t.representation in
540540- { t with equation = type_decl_equation s t.equation; representation }
695695+ let equation' = type_decl_equation s t.equation in
696696+ let representation' = option_sharing type_decl_representation s t.representation in
697697+ if equation' == t.equation && representation' == t.representation then t
698698+ else { t with equation = equation'; representation = representation' }
541699542700and type_decl_representation s t =
543701 let open Component.TypeDecl.Representation in
544702 match t with
545545- | Variant cs -> Variant (List.map (type_decl_constructor s) cs)
546546- | Record fs -> Record (List.map (type_decl_field s) fs)
703703+ | Variant cs ->
704704+ let cs' = list_sharing type_decl_constructor s cs in
705705+ if cs' == cs then t else Variant cs'
706706+ | Record fs ->
707707+ let fs' = list_sharing type_decl_field s fs in
708708+ if fs' == fs then t else Record fs'
547709 | Record_unboxed_product fs ->
548548- Record_unboxed_product (List.map (type_decl_unboxed_field s) fs)
710710+ let fs' = list_sharing type_decl_unboxed_field s fs in
711711+ if fs' == fs then t else Record_unboxed_product fs'
549712 | Extensible -> t
550713551714and type_decl_constructor s t =
552715 let open Component.TypeDecl.Constructor in
553553- let args = type_decl_constructor_arg s t.args in
554554- let res = option_ type_expr s t.res in
555555- { t with args; res }
716716+ let args' = type_decl_constructor_arg s t.args in
717717+ let res' = option_sharing type_expr s t.res in
718718+ if args' == t.args && res' == t.res then t
719719+ else { t with args = args'; res = res' }
556720557721and type_poly_var s v =
558722 let open Component.TypeExpr.Polymorphic_variant in
559723 let map_constr c =
560724 let open Constructor in
561561- {
562562- name = c.name;
563563- constant = c.constant;
564564- arguments = List.map (type_expr s) c.arguments;
565565- doc = c.doc;
566566- }
725725+ let arguments' = list_sharing type_expr s c.arguments in
726726+ if arguments' == c.arguments then c
727727+ else { c with arguments = arguments' }
567728 in
568568- let map_element = function
729729+ (* Note: poly variant substitution can flatten elements, so we can't
730730+ always share the list. Check if any Type element expands. *)
731731+ let changed = ref false in
732732+ let elements' = List.flatten (List.map (function
569733 | Type t -> (
570734 match type_expr s t with
571571- | Polymorphic_variant v -> v.elements
572572- | x -> [ Type x ])
573573- | Constructor c -> [ Constructor (map_constr c) ]
574574- in
575575-576576- { kind = v.kind; elements = List.flatten (List.map map_element v.elements) }
735735+ | Polymorphic_variant v -> changed := true; v.elements
736736+ | x ->
737737+ if x != t then changed := true;
738738+ [ Type x ])
739739+ | Constructor c ->
740740+ let c' = map_constr c in
741741+ if c' != c then changed := true;
742742+ [ Constructor c' ]
743743+ ) v.elements) in
744744+ if !changed then { kind = v.kind; elements = elements' }
745745+ else v
577746578747and type_object s o =
579748 let open Component.TypeExpr.Object in
580580- let map_field = function
581581- | Method m -> Method { m with type_ = type_expr s m.type_ }
582582- | Inherit t -> Inherit (type_expr s t)
583583- in
584584- { fields = List.map map_field o.fields; open_ = o.open_ }
749749+ let fields' = list_sharing (fun s f ->
750750+ match f with
751751+ | Method m ->
752752+ let type_' = type_expr s m.type_ in
753753+ if type_' == m.type_ then f
754754+ else Method { m with type_ = type_' }
755755+ | Inherit te ->
756756+ let te' = type_expr s te in
757757+ if te' == te then f else Inherit te'
758758+ ) s o.fields in
759759+ if fields' == o.fields then o
760760+ else { fields = fields'; open_ = o.open_ }
585761586762and type_package s p =
587763 let open Component.TypeExpr.Package in
588588- let sub (x, y) = (type_fragment s x, type_expr s y) in
589589- {
590590- path =
591591- (match module_type_path s p.path with
592592- | Not_replaced p -> p
593593- | Replaced (Path p) -> p.p_path
594594- | Replaced _ ->
595595- (* substituting away a packed module type by a non-path module type is a type error *)
596596- assert false);
597597- substitutions = List.map sub p.substitutions;
598598- }
764764+ let path' =
765765+ match module_type_path s p.path with
766766+ | Not_replaced p -> p
767767+ | Replaced (Path pt) -> pt.p_path
768768+ | Replaced _ -> assert false
769769+ in
770770+ let substitutions' = list_sharing (fun s ((x, y) as sub) ->
771771+ let x' = type_fragment s x in
772772+ let y' = type_expr s y in
773773+ if x' == x && y' == y then sub else (x', y')
774774+ ) s p.substitutions in
775775+ if path' == p.path && substitutions' == p.substitutions then p
776776+ else { path = path'; substitutions = substitutions' }
599777600778and type_expr s t =
601779 let open Component.TypeExpr in
602780 match t with
603603- | Var _ as v -> v
604604- | Any -> Any
605605- | Alias (t, str) -> Alias (type_expr s t, str)
606606- | Arrow (lbl, t1, t2, modes, ret_modes) -> Arrow (lbl, type_expr s t1, type_expr s t2, modes, ret_modes)
607607- | Tuple ts -> Tuple (List.map (fun (lbl, ty) -> (lbl, type_expr s ty)) ts)
608608- | Unboxed_tuple ts -> Unboxed_tuple (List.map (fun (l, t) -> l, type_expr s t) ts)
781781+ | Var _ | Any -> t
782782+ | Alias (te, str) ->
783783+ let te' = type_expr s te in
784784+ if te' == te then t else Alias (te', str)
785785+ | Arrow (lbl, t1, t2, modes, ret_modes) ->
786786+ let t1' = type_expr s t1 in
787787+ let t2' = type_expr s t2 in
788788+ if t1' == t1 && t2' == t2 then t
789789+ else Arrow (lbl, t1', t2', modes, ret_modes)
790790+ | Tuple ts ->
791791+ let ts' = list_sharing (fun s (lbl, ty) ->
792792+ let ty' = type_expr s ty in
793793+ if ty' == ty then (lbl, ty) else (lbl, ty')
794794+ ) s ts in
795795+ if ts' == ts then t else Tuple ts'
796796+ | Unboxed_tuple ts ->
797797+ let ts' = list_sharing (fun s (l, te) ->
798798+ let te' = type_expr s te in
799799+ if te' == te then (l, te) else (l, te')
800800+ ) s ts in
801801+ if ts' == ts then t else Unboxed_tuple ts'
609802 | Constr (p, ts) -> (
610803 match type_path s p with
611611- | Replaced (t, eq) ->
804804+ | Replaced (te, eq) ->
612805 let mk_var acc pexpr param =
613806 match param.Odoc_model.Lang.TypeDecl.desc with
614807 | Any -> acc
···620813 (List.length eq.params) (List.length ts);
621814 assert false);
622815 let vars = List.fold_left2 mk_var [] ts eq.params in
623623- substitute_vars vars t
624624- | Not_replaced p -> Constr (p, List.map (type_expr s) ts))
625625- | Polymorphic_variant v -> Polymorphic_variant (type_poly_var s v)
626626- | Object o -> Object (type_object s o)
627627- | Class (p, ts) -> Class (class_type_path s p, List.map (type_expr s) ts)
628628- | Poly (strs, ts) -> Poly (strs, type_expr s ts)
629629- | Quote t -> Quote (type_expr s t)
630630- | Splice t -> Splice (type_expr s t)
631631- | Package p -> Package (type_package s p)
816816+ substitute_vars vars te
817817+ | Not_replaced p' ->
818818+ let ts' = list_sharing type_expr s ts in
819819+ if p' == p && ts' == ts then t else Constr (p', ts'))
820820+ | Polymorphic_variant v ->
821821+ let v' = type_poly_var s v in
822822+ if v' == v then t else Polymorphic_variant v'
823823+ | Object o ->
824824+ let o' = type_object s o in
825825+ if o' == o then t else Object o'
826826+ | Class (p, ts) ->
827827+ let p' = class_type_path s p in
828828+ let ts' = list_sharing type_expr s ts in
829829+ if p' == p && ts' == ts then t else Class (p', ts')
830830+ | Poly (strs, te) ->
831831+ let te' = type_expr s te in
832832+ if te' == te then t else Poly (strs, te')
833833+ | Quote te ->
834834+ let te' = type_expr s te in
835835+ if te' == te then t else Quote te'
836836+ | Splice te ->
837837+ let te' = type_expr s te in
838838+ if te' == te then t else Splice te'
839839+ | Package p ->
840840+ let p' = type_package s p in
841841+ if p' == p then t else Package p'
632842633843and simple_expansion :
634844 t ->
···637847 fun s t ->
638848 let open Component.ModuleType in
639849 match t with
640640- | Signature sg -> Signature (signature s sg)
641641- | Functor (arg, sg) -> Functor (functor_parameter s arg, simple_expansion s sg)
850850+ | Signature sg ->
851851+ let sg' = signature s sg in
852852+ if sg' == sg then t else Signature sg'
853853+ | Functor (arg, sg) ->
854854+ let arg' = functor_parameter s arg in
855855+ let sg' = simple_expansion s sg in
856856+ if arg' == arg && sg' == sg then t else Functor (arg', sg')
642857643858and module_type s t =
644859 let open Component.ModuleType in
645645- let expr =
646646- match t.expr with Some m -> Some (module_type_expr s m) | None -> None
647647- in
648648- { expr; source_loc = t.source_loc; source_loc_jane = t.source_loc_jane ; doc = t.doc; canonical = t.canonical }
860860+ let expr' = option_sharing module_type_expr s t.expr in
861861+ if expr' == t.expr then t
862862+ else { t with expr = expr' }
649863650864and module_type_substitution s t =
651865 let open Component.ModuleTypeSubstitution in
652652- let manifest = module_type_expr s t.manifest in
653653- { manifest; doc = t.doc }
866866+ let manifest' = module_type_expr s t.manifest in
867867+ if manifest' == t.manifest then t
868868+ else { manifest = manifest'; doc = t.doc }
654869655870and functor_parameter s t =
656871 let open Component.FunctorParameter in
657872 match t with
658658- | Named arg -> Named { arg with expr = module_type_expr s arg.expr }
659659- | Unit -> Unit
873873+ | Named arg ->
874874+ let expr' = module_type_expr s arg.expr in
875875+ if expr' == arg.expr then t
876876+ else Named { arg with expr = expr' }
877877+ | Unit -> t
660878661879and module_type_type_of_desc s t =
662880 let open Component.ModuleType in
663881 match t with
664664- | ModPath p -> ModPath (module_path s p)
665665- | StructInclude p -> StructInclude (module_path s p)
882882+ | ModPath p ->
883883+ let p' = module_path s p in
884884+ if p' == p then t else ModPath p'
885885+ | StructInclude p ->
886886+ let p' = module_path s p in
887887+ if p' == p then t else StructInclude p'
666888667889and u_module_type_expr s t =
668890 let open Component.ModuleType.U in
669891 match t with
670892 | Path p -> (
671893 match module_type_path s p with
672672- | Not_replaced p -> Path p
894894+ | Not_replaced p' ->
895895+ if p' == p then t else Path p'
673896 | Replaced eqn -> (
674897 match eqn with
675898 | Path p -> Path p.p_path
676899 | Signature s -> Signature s
677677- | TypeOf t -> TypeOf (t.t_desc, t.t_original_path)
900900+ | TypeOf tv -> TypeOf (tv.t_desc, tv.t_original_path)
678901 | With w -> With (w.w_substitutions, w.w_expr)
679679- | Functor _ ->
680680- (* non functor cannot be substituted away to a functor *)
681681- assert false
682682- | Strengthen s -> Strengthen (s.s_expr, s.s_path, s.s_aliasable)))
683683- | Signature sg -> Signature (signature s sg)
902902+ | Functor _ -> assert false
903903+ | Strengthen sv -> Strengthen (sv.s_expr, sv.s_path, sv.s_aliasable)))
904904+ | Signature sg ->
905905+ let sg' = signature s sg in
906906+ if sg' == sg then t else Signature sg'
684907 | With (subs, e) ->
685685- With
686686- (List.map (with_module_type_substitution s) subs, u_module_type_expr s e)
908908+ let subs' = list_sharing with_module_type_substitution s subs in
909909+ let e' = u_module_type_expr s e in
910910+ if subs' == subs && e' == e then t else With (subs', e')
687911 | TypeOf (t_desc, t_original_path) ->
688688- TypeOf (module_type_type_of_desc s t_desc, t_original_path)
912912+ let t_desc' = module_type_type_of_desc s t_desc in
913913+ if t_desc' == t_desc then t else TypeOf (t_desc', t_original_path)
689914 | Strengthen (expr, path, aliasable) ->
690690- let expr = u_module_type_expr s expr in
691691- let path = module_path s path in
692692- Strengthen (expr, path, aliasable)
915915+ let expr' = u_module_type_expr s expr in
916916+ let path' = module_path s path in
917917+ if expr' == expr && path' == path then t
918918+ else Strengthen (expr', path', aliasable)
693919694920and module_type_expr s t =
695921 let open Component.ModuleType in
696922 match t with
697923 | Path { p_path; p_expansion } -> (
698924 match module_type_path s p_path with
699699- | Not_replaced p_path ->
700700- Path { p_path; p_expansion = option_ simple_expansion s p_expansion }
925925+ | Not_replaced p_path' ->
926926+ let p_expansion' = option_sharing simple_expansion s p_expansion in
927927+ if p_path' == p_path && p_expansion' == p_expansion then t
928928+ else Path { p_path = p_path'; p_expansion = p_expansion' }
701929 | Replaced s -> s)
702702- | Signature sg -> Signature (signature s sg)
930930+ | Signature sg ->
931931+ let sg' = signature s sg in
932932+ if sg' == sg then t else Signature sg'
703933 | Functor (arg, expr) ->
704704- Functor (functor_parameter s arg, module_type_expr s expr)
934934+ let arg' = functor_parameter s arg in
935935+ let expr' = module_type_expr s expr in
936936+ if arg' == arg && expr' == expr then t
937937+ else Functor (arg', expr')
705938 | With { w_substitutions; w_expansion; w_expr } ->
706706- With
707707- {
708708- w_substitutions =
709709- List.map (with_module_type_substitution s) w_substitutions;
710710- w_expansion = option_ simple_expansion s w_expansion;
711711- w_expr = u_module_type_expr s w_expr;
712712- }
713713- | TypeOf t ->
714714- TypeOf
715715- {
716716- t with
717717- t_desc = module_type_type_of_desc s t.t_desc;
718718- t_expansion = option_ simple_expansion s t.t_expansion;
719719- }
939939+ let w_substitutions' =
940940+ list_sharing with_module_type_substitution s w_substitutions in
941941+ let w_expansion' = option_sharing simple_expansion s w_expansion in
942942+ let w_expr' = u_module_type_expr s w_expr in
943943+ if w_substitutions' == w_substitutions
944944+ && w_expansion' == w_expansion
945945+ && w_expr' == w_expr then t
946946+ else With { w_substitutions = w_substitutions';
947947+ w_expansion = w_expansion';
948948+ w_expr = w_expr' }
949949+ | TypeOf tv ->
950950+ let t_desc' = module_type_type_of_desc s tv.t_desc in
951951+ let t_expansion' = option_sharing simple_expansion s tv.t_expansion in
952952+ if t_desc' == tv.t_desc && t_expansion' == tv.t_expansion then t
953953+ else TypeOf { tv with t_desc = t_desc'; t_expansion = t_expansion' }
720954 | Strengthen { s_expr; s_path; s_aliasable; s_expansion } ->
721721- Strengthen
722722- {
723723- s_expr = u_module_type_expr s s_expr;
724724- s_path = module_path s s_path;
725725- s_aliasable;
726726- s_expansion = option_ simple_expansion s s_expansion
727727- }
955955+ let s_expr' = u_module_type_expr s s_expr in
956956+ let s_path' = module_path s s_path in
957957+ let s_expansion' = option_sharing simple_expansion s s_expansion in
958958+ if s_expr' == s_expr && s_path' == s_path && s_expansion' == s_expansion then t
959959+ else Strengthen { s_expr = s_expr'; s_path = s_path';
960960+ s_aliasable; s_expansion = s_expansion' }
728961729962and with_module_type_substitution s sub =
730963 let open Component.ModuleType in
731964 match sub with
732732- | ModuleEq (f, m) -> ModuleEq (module_fragment s f, module_decl s m)
733733- | ModuleSubst (f, p) -> ModuleSubst (module_fragment s f, module_path s p)
734734- | TypeEq (f, eq) -> TypeEq (type_fragment s f, type_decl_equation s eq)
735735- | TypeSubst (f, eq) -> TypeSubst (type_fragment s f, type_decl_equation s eq)
965965+ | ModuleEq (f, m) ->
966966+ let f' = module_fragment s f in
967967+ let m' = module_decl s m in
968968+ if f' == f && m' == m then sub else ModuleEq (f', m')
969969+ | ModuleSubst (f, p) ->
970970+ let f' = module_fragment s f in
971971+ let p' = module_path s p in
972972+ if f' == f && p' == p then sub else ModuleSubst (f', p')
973973+ | TypeEq (f, eq) ->
974974+ let f' = type_fragment s f in
975975+ let eq' = type_decl_equation s eq in
976976+ if f' == f && eq' == eq then sub else TypeEq (f', eq')
977977+ | TypeSubst (f, eq) ->
978978+ let f' = type_fragment s f in
979979+ let eq' = type_decl_equation s eq in
980980+ if f' == f && eq' == eq then sub else TypeSubst (f', eq')
736981 | ModuleTypeEq (f, eq) ->
737737- ModuleTypeEq (module_type_fragment s f, module_type_expr s eq)
982982+ let f' = module_type_fragment s f in
983983+ let eq' = module_type_expr s eq in
984984+ if f' == f && eq' == eq then sub else ModuleTypeEq (f', eq')
738985 | ModuleTypeSubst (f, eq) ->
739739- ModuleTypeSubst (module_type_fragment s f, module_type_expr s eq)
986986+ let f' = module_type_fragment s f in
987987+ let eq' = module_type_expr s eq in
988988+ if f' == f && eq' == eq then sub else ModuleTypeSubst (f', eq')
740989741990and module_decl s t =
742991 match t with
743743- | Alias (p, e) -> Alias (module_path s p, option_ simple_expansion s e)
744744- | ModuleType t -> ModuleType (module_type_expr s t)
992992+ | Alias (p, e) ->
993993+ let p' = module_path s p in
994994+ let e' = option_sharing simple_expansion s e in
995995+ if p' == p && e' == e then t else Alias (p', e')
996996+ | ModuleType mt ->
997997+ let mt' = module_type_expr s mt in
998998+ if mt' == mt then t else ModuleType mt'
7459997461000and include_decl s t =
7471001 match t with
748748- | Include.Alias p -> Include.Alias (module_path s p)
749749- | ModuleType t -> ModuleType (u_module_type_expr s t)
10021002+ | Include.Alias p ->
10031003+ let p' = module_path s p in
10041004+ if p' == p then t else Include.Alias p'
10051005+ | ModuleType mt ->
10061006+ let mt' = u_module_type_expr s mt in
10071007+ if mt' == mt then t else ModuleType mt'
75010087511009and module_ s t =
7521010 let open Component.Module in
753753- let type_ = module_decl s t.type_ in
754754- let canonical = t.canonical in
755755- { t with type_; canonical }
10111011+ let type_' = module_decl s t.type_ in
10121012+ if type_' == t.type_ then t
10131013+ else { t with type_ = type_' }
75610147571015and module_substitution s m =
7581016 let open Component.ModuleSubstitution in
759759- let manifest = module_path s m.manifest in
760760- { manifest; doc = m.doc }
10171017+ let manifest' = module_path s m.manifest in
10181018+ if manifest' == m.manifest then m
10191019+ else { manifest = manifest'; doc = m.doc }
76110207621021and type_decl_field s f =
7631022 let open Component.TypeDecl.Field in
764764- { f with type_ = type_expr s f.type_ }
10231023+ let type_' = type_expr s f.type_ in
10241024+ if type_' == f.type_ then f
10251025+ else { f with type_ = type_' }
76510267661027and type_decl_unboxed_field s f =
7671028 let open Component.TypeDecl.UnboxedField in
768768- { f with type_ = type_expr s f.type_ }
10291029+ let type_' = type_expr s f.type_ in
10301030+ if type_' == f.type_ then f
10311031+ else { f with type_ = type_' }
76910327701033and type_decl_constructor_arg s a =
7711034 let open Component.TypeDecl.Constructor in
7721035 match a with
773773- | Tuple ts -> Tuple (list type_expr s ts)
774774- | Record fs -> Record (list type_decl_field s fs)
10361036+ | Tuple ts ->
10371037+ let ts' = list_sharing type_expr s ts in
10381038+ if ts' == ts then a else Tuple ts'
10391039+ | Record fs ->
10401040+ let fs' = list_sharing type_decl_field s fs in
10411041+ if fs' == fs then a else Record fs'
77510427761043and type_decl_equation s t =
7771044 let open Component.TypeDecl.Equation in
778778- {
779779- t with
780780- manifest = option_ type_expr s t.manifest;
781781- constraints =
782782- List.map (fun (x, y) -> (type_expr s x, type_expr s y)) t.constraints;
783783- }
10451045+ let manifest' = option_sharing type_expr s t.manifest in
10461046+ let constraints' = list_sharing (fun s ((x, y) as p) ->
10471047+ let x' = type_expr s x in
10481048+ let y' = type_expr s y in
10491049+ if x' == x && y' == y then p else (x', y')
10501050+ ) s t.constraints in
10511051+ if manifest' == t.manifest && constraints' == t.constraints then t
10521052+ else { t with manifest = manifest'; constraints = constraints' }
78410537851054and exception_ s e =
7861055 let open Component.Exception in
787787- let res = option_ type_expr s e.res in
788788- let args = type_decl_constructor_arg s e.args in
789789- { e with args; res }
10561056+ let res' = option_sharing type_expr s e.res in
10571057+ let args' = type_decl_constructor_arg s e.args in
10581058+ if res' == e.res && args' == e.args then e
10591059+ else { e with args = args'; res = res' }
79010607911061and extension_constructor s c =
7921062 let open Component.Extension.Constructor in
793793- {
794794- c with
795795- args = type_decl_constructor_arg s c.args;
796796- res = option_ type_expr s c.res;
797797- }
10631063+ let args' = type_decl_constructor_arg s c.args in
10641064+ let res' = option_sharing type_expr s c.res in
10651065+ if args' == c.args && res' == c.res then c
10661066+ else { c with args = args'; res = res' }
79810677991068and extension s e =
8001069 let open Component.Extension in
801801- let type_path =
10701070+ let type_path' =
8021071 match type_path s e.type_path with
8031072 | Not_replaced p -> p
8041073 | Replaced (TypeExpr.Constr (p, _), _) -> p
805805- | Replaced _ -> (* What else is possible ? *) assert false
806806- and constructors = List.map (extension_constructor s) e.constructors in
807807- { e with type_path; constructors }
10741074+ | Replaced _ -> assert false
10751075+ in
10761076+ let constructors' = list_sharing extension_constructor s e.constructors in
10771077+ if type_path' == e.type_path && constructors' == e.constructors then e
10781078+ else { e with type_path = type_path'; constructors = constructors' }
80810798091080and include_ s i =
8101081 let open Component.Include in
811811- {
812812- i with
813813- decl = include_decl s i.decl;
814814- strengthened = option_ module_path s i.strengthened;
815815- expansion_ = apply_sig_map_sg s i.expansion_;
816816- }
10821082+ let decl' = include_decl s i.decl in
10831083+ let strengthened' = option_sharing module_path s i.strengthened in
10841084+ let expansion_' = apply_sig_map_sg s i.expansion_ in
10851085+ if decl' == i.decl && strengthened' == i.strengthened && expansion_' == i.expansion_
10861086+ then i
10871087+ else { i with decl = decl'; strengthened = strengthened'; expansion_ = expansion_' }
81710888181089and open_ s o =
8191090 let open Component.Open in
820820- { expansion = apply_sig_map_sg s o.expansion; doc = o.doc }
10911091+ let expansion' = apply_sig_map_sg s o.expansion in
10921092+ if expansion' == o.expansion then o
10931093+ else { expansion = expansion'; doc = o.doc }
82110948221095and value s v =
8231096 let open Component.Value in
824824- { v with type_ = type_expr s v.type_ }
10971097+ let type_' = type_expr s v.type_ in
10981098+ if type_' == v.type_ then v
10991099+ else { v with type_ = type_' }
82511008261101and class_ s c =
8271102 let open Component.Class in
828828- let expansion = option_ class_signature s c.expansion in
829829- { c with type_ = class_decl s c.type_; expansion }
11031103+ let type_' = class_decl s c.type_ in
11041104+ let expansion' = option_sharing class_signature s c.expansion in
11051105+ if type_' == c.type_ && expansion' == c.expansion then c
11061106+ else { c with type_ = type_'; expansion = expansion' }
8301107831831-and class_decl s =
11081108+and class_decl s t =
8321109 let open Component.Class in
833833- function
834834- | ClassType e -> ClassType (class_type_expr s e)
835835- | Arrow (lbl, t, d) -> Arrow (lbl, type_expr s t, class_decl s d)
11101110+ match t with
11111111+ | ClassType e ->
11121112+ let e' = class_type_expr s e in
11131113+ if e' == e then t else ClassType e'
11141114+ | Arrow (lbl, te, d) ->
11151115+ let te' = type_expr s te in
11161116+ let d' = class_decl s d in
11171117+ if te' == te && d' == d then t else Arrow (lbl, te', d')
8361118837837-and class_type_expr s =
11191119+and class_type_expr s t =
8381120 let open Component.ClassType in
839839- function
840840- | Constr (p, ts) -> Constr (class_type_path s p, List.map (type_expr s) ts)
841841- | Signature sg -> Signature (class_signature s sg)
11211121+ match t with
11221122+ | Constr (p, ts) ->
11231123+ let p' = class_type_path s p in
11241124+ let ts' = list_sharing type_expr s ts in
11251125+ if p' == p && ts' == ts then t else Constr (p', ts')
11261126+ | Signature sg ->
11271127+ let sg' = class_signature s sg in
11281128+ if sg' == sg then t else Signature sg'
84211298431130and class_type s c =
8441131 let open Component.ClassType in
845845- let expansion = option_ class_signature s c.expansion in
846846- { c with expr = class_type_expr s c.expr; expansion }
11321132+ let expr' = class_type_expr s c.expr in
11331133+ let expansion' = option_sharing class_signature s c.expansion in
11341134+ if expr' == c.expr && expansion' == c.expansion then c
11351135+ else { c with expr = expr'; expansion = expansion' }
8471136848848-and class_signature_item s =
11371137+and class_signature_item s item =
8491138 let open Component.ClassSignature in
850850- function
851851- | Method (id, m) -> Method (id, method_ s m)
852852- | InstanceVariable (id, i) -> InstanceVariable (id, instance_variable s i)
853853- | Constraint cst -> Constraint (class_constraint s cst)
854854- | Inherit e -> Inherit (inherit_ s e)
855855- | Comment _ as y -> y
11391139+ match item with
11401140+ | Method (id, m) ->
11411141+ let m' = method_ s m in
11421142+ if m' == m then item else Method (id, m')
11431143+ | InstanceVariable (id, i) ->
11441144+ let i' = instance_variable s i in
11451145+ if i' == i then item else InstanceVariable (id, i')
11461146+ | Constraint cst ->
11471147+ let cst' = class_constraint s cst in
11481148+ if cst' == cst then item else Constraint cst'
11491149+ | Inherit e ->
11501150+ let e' = inherit_ s e in
11511151+ if e' == e then item else Inherit e'
11521152+ | Comment _ -> item
85611538571154and class_signature s sg =
8581155 let open Component.ClassSignature in
859859- {
860860- sg with
861861- self = option_ type_expr s sg.self;
862862- items = List.map (class_signature_item s) sg.items;
863863- }
11561156+ let self' = option_sharing type_expr s sg.self in
11571157+ let items' = list_sharing class_signature_item s sg.items in
11581158+ if self' == sg.self && items' == sg.items then sg
11591159+ else { sg with self = self'; items = items' }
86411608651161and method_ s m =
8661162 let open Component.Method in
867867- { m with type_ = type_expr s m.type_ }
11631163+ let type_' = type_expr s m.type_ in
11641164+ if type_' == m.type_ then m
11651165+ else { m with type_ = type_' }
86811668691167and instance_variable s i =
8701168 let open Component.InstanceVariable in
871871- { i with type_ = type_expr s i.type_ }
11691169+ let type_' = type_expr s i.type_ in
11701170+ if type_' == i.type_ then i
11711171+ else { i with type_ = type_' }
87211728731173and class_constraint s cst =
8741174 let open Component.ClassSignature.Constraint in
875875- { cst with left = type_expr s cst.left; right = type_expr s cst.right }
11751175+ let left' = type_expr s cst.left in
11761176+ let right' = type_expr s cst.right in
11771177+ if left' == cst.left && right' == cst.right then cst
11781178+ else { cst with left = left'; right = right' }
87611798771180and inherit_ s ih =
8781181 let open Component.ClassSignature.Inherit in
879879- { ih with expr = class_type_expr s ih.expr }
11821182+ let expr' = class_type_expr s ih.expr in
11831183+ if expr' == ih.expr then ih
11841184+ else { ih with expr = expr' }
8801185881881-and rename_bound_idents s sg =
11861186+and rename_bound_idents s sg items =
8821187 let open Component.Signature in
883883- let new_module_id id =
884884- try
885885- match ModuleMap.find (id :> Ident.module_) s.module_ with
886886- | `Renamed (`LModule _ as x) -> x
887887- | `Prefixed (_, _) ->
888888- (* This is unusual but can happen when we have TypeOf expressions. It means
889889- we're already prefixing this module path, hence we can essentially rename
890890- it to whatever we like because it's never going to be referred to. *)
891891- Ident.Rename.module_ id
892892- | _ -> failwith "Error"
893893- with Not_found -> Ident.Rename.module_ id
894894- in
895895- let new_module_type_id id =
896896- try
897897- match ModuleTypeMap.find id s.module_type with
898898- | `Renamed x -> x
899899- | `Prefixed (_, _) -> Ident.Rename.module_type id
900900- with Not_found -> Ident.Rename.module_type id
901901- in
902902- let new_type_id id =
903903- try
904904- match TypeMap.find (id :> Ident.type_) s.type_ with
905905- | `Renamed (`LType _ as x) -> x
906906- | `Prefixed (_, _) -> Ident.Rename.type_ id
907907- with Not_found -> Ident.Rename.type_ id
908908- in
909909- let new_class_id id =
910910- try
911911- match TypeMap.find (id :> Ident.type_) s.class_type with
912912- | `Renamed (`LType _ as x) -> x
913913- | `Prefixed (_, _) -> Ident.Rename.type_ id
914914- with Not_found -> Ident.Rename.type_ id
915915- in
916916- let new_class_type_id id =
917917- try
918918- match TypeMap.find (id :> Ident.type_) s.class_type with
919919- | `Renamed (`LType _ as x) -> x
920920- | `Prefixed (_, _) -> Ident.Rename.type_ id
921921- with Not_found -> Ident.Rename.type_ id
11881188+ (* The closures used to look up rename targets only depend on the
11891189+ immutable substitution map, so they're hoisted to local helpers
11901190+ that don't capture per-call state. Each recursive call would
11911191+ otherwise reallocate them. *)
11921192+ let rec loop s sg = function
11931193+ | [] -> (s, List.rev sg)
11941194+ | Module (id, r, m) :: rest ->
11951195+ let id' = rbi_new_module_id s id in
11961196+ loop
11971197+ (rename_module (id :> Ident.module_) (id' :> Ident.module_) s)
11981198+ (Module (id', r, m) :: sg)
11991199+ rest
12001200+ | ModuleSubstitution (id, m) :: rest ->
12011201+ let id' = rbi_new_module_id s id in
12021202+ loop
12031203+ (rename_module (id :> Ident.module_) (id' :> Ident.module_) s)
12041204+ (ModuleSubstitution (id', m) :: sg)
12051205+ rest
12061206+ | ModuleType (id, mt) :: rest ->
12071207+ let id' = rbi_new_module_type_id s id in
12081208+ loop
12091209+ (rename_module_type id id' s)
12101210+ (ModuleType (id', mt) :: sg)
12111211+ rest
12121212+ | ModuleTypeSubstitution (id, mt) :: rest ->
12131213+ let id' = rbi_new_module_type_id s id in
12141214+ loop
12151215+ (rename_module_type id id' s)
12161216+ (ModuleTypeSubstitution (id', mt) :: sg)
12171217+ rest
12181218+ | Type (id, r, t) :: rest ->
12191219+ let id' = rbi_new_type_id s id in
12201220+ loop
12211221+ (rename_type (id :> Ident.type_) (id' :> Ident.type_) s)
12221222+ (Type (id', r, t) :: sg)
12231223+ rest
12241224+ | TypeSubstitution (id, t) :: rest ->
12251225+ let id' = rbi_new_type_id s id in
12261226+ loop
12271227+ (rename_type (id :> Ident.type_) (id' :> Ident.type_) s)
12281228+ (TypeSubstitution (id', t) :: sg)
12291229+ rest
12301230+ | Exception (id, e) :: rest ->
12311231+ let id' = Ident.Rename.exception_ id in
12321232+ loop s (Exception (id', e) :: sg) rest
12331233+ | TypExt e :: rest -> loop s (TypExt e :: sg) rest
12341234+ | Value (id, v) :: rest ->
12351235+ let id' = Ident.Rename.value id in
12361236+ loop s (Value (id', v) :: sg) rest
12371237+ | Class (id, r, c) :: rest ->
12381238+ let id' = rbi_new_class_id s id in
12391239+ loop
12401240+ (rename_class_type (id :> Ident.type_) (id' :> Ident.type_) s)
12411241+ (Class (id', r, c) :: sg)
12421242+ rest
12431243+ | ClassType (id, r, c) :: rest ->
12441244+ let id' = rbi_new_class_type_id s id in
12451245+ loop
12461246+ (rename_class_type (id :> Ident.type_) (id' :> Ident.type_) s)
12471247+ (ClassType (id', r, c) :: sg)
12481248+ rest
12491249+ | Include i :: rest ->
12501250+ loop s (Include i :: sg) rest
12511251+ | Open o :: rest ->
12521252+ loop s (Open o :: sg) rest
12531253+ | (Comment _ as item) :: rest -> loop s (item :: sg) rest
9221254 in
923923- function
924924- | [] -> (s, List.rev sg)
925925- | Module (id, r, m) :: rest ->
926926- let id' = new_module_id id in
927927- rename_bound_idents
928928- (rename_module (id :> Ident.module_) (id' :> Ident.module_) s)
929929- (Module (id', r, m) :: sg)
930930- rest
931931- | ModuleSubstitution (id, m) :: rest ->
932932- let id' = new_module_id id in
933933- rename_bound_idents
934934- (rename_module (id :> Ident.module_) (id' :> Ident.module_) s)
935935- (ModuleSubstitution (id', m) :: sg)
936936- rest
937937- | ModuleType (id, mt) :: rest ->
938938- let id' = new_module_type_id id in
939939- rename_bound_idents
940940- (rename_module_type id id' s)
941941- (ModuleType (id', mt) :: sg)
942942- rest
943943- | ModuleTypeSubstitution (id, mt) :: rest ->
944944- let id' = new_module_type_id id in
945945- rename_bound_idents
946946- (rename_module_type id id' s)
947947- (ModuleTypeSubstitution (id', mt) :: sg)
948948- rest
949949- | Type (id, r, t) :: rest ->
950950- let id' = new_type_id id in
951951- rename_bound_idents
952952- (rename_type (id :> Ident.type_) (id' :> Ident.type_) s)
953953- (Type (id', r, t) :: sg)
954954- rest
955955- | TypeSubstitution (id, t) :: rest ->
956956- let id' = new_type_id id in
957957- rename_bound_idents
958958- (rename_type (id :> Ident.type_) (id' :> Ident.type_) s)
959959- (TypeSubstitution (id', t) :: sg)
960960- rest
961961- | Exception (id, e) :: rest ->
962962- let id' = Ident.Rename.exception_ id in
963963- rename_bound_idents s (Exception (id', e) :: sg) rest
964964- | TypExt e :: rest -> rename_bound_idents s (TypExt e :: sg) rest
965965- | Value (id, v) :: rest ->
966966- let id' = Ident.Rename.value id in
967967- rename_bound_idents s (Value (id', v) :: sg) rest
968968- | Class (id, r, c) :: rest ->
969969- let id' = new_class_id id in
970970- rename_bound_idents
971971- (rename_class_type (id :> Ident.type_) (id' :> Ident.type_) s)
972972- (Class (id', r, c) :: sg)
973973- rest
974974- | ClassType (id, r, c) :: rest ->
975975- let id' = new_class_type_id id in
976976- rename_bound_idents
977977- (rename_class_type (id :> Ident.type_) (id' :> Ident.type_) s)
978978- (ClassType (id', r, c) :: sg)
979979- rest
980980- | Include ({ expansion_; _ } as i) :: rest ->
981981- let s, items = rename_bound_idents s [] expansion_.items in
982982- rename_bound_idents s
983983- (Include { i with expansion_ = { expansion_ with items; removed = [] } }
984984- :: sg)
985985- rest
986986- | Open { expansion; doc } :: rest ->
987987- let s, items = rename_bound_idents s [] expansion.items in
988988- rename_bound_idents s
989989- (Open { expansion = { expansion with items; removed = [] }; doc } :: sg)
990990- rest
991991- | (Comment _ as item) :: rest -> rename_bound_idents s (item :: sg) rest
12551255+ loop s sg items
12561256+12571257+(* These helpers used to be local closures inside rename_bound_idents,
12581258+ reallocated on every recursive call. They depend only on the substitution
12591259+ record so they can be defined once at module level. *)
12601260+and rbi_new_module_id s id =
12611261+ try
12621262+ match ModuleMap.find (id :> Ident.module_) s.module_ with
12631263+ | `Renamed (`LModule _ as x) -> x
12641264+ | `Prefixed (_, _) ->
12651265+ (* Unusual but can happen with TypeOf expressions. *)
12661266+ Ident.Rename.module_ id
12671267+ | _ -> failwith "Error"
12681268+ with Not_found -> Ident.Rename.module_ id
12691269+12701270+and rbi_new_module_type_id s id =
12711271+ try
12721272+ match ModuleTypeMap.find id s.module_type with
12731273+ | `Renamed x -> x
12741274+ | `Prefixed (_, _) -> Ident.Rename.module_type id
12751275+ with Not_found -> Ident.Rename.module_type id
12761276+12771277+and rbi_new_type_id s id =
12781278+ try
12791279+ match TypeMap.find (id :> Ident.type_) s.type_ with
12801280+ | `Renamed (`LType _ as x) -> x
12811281+ | `Prefixed (_, _) -> Ident.Rename.type_ id
12821282+ with Not_found -> Ident.Rename.type_ id
12831283+12841284+and rbi_new_class_id s id =
12851285+ try
12861286+ match TypeMap.find (id :> Ident.type_) s.class_type with
12871287+ | `Renamed (`LType _ as x) -> x
12881288+ | `Prefixed (_, _) -> Ident.Rename.type_ id
12891289+ with Not_found -> Ident.Rename.type_ id
12901290+12911291+and rbi_new_class_type_id s id =
12921292+ try
12931293+ match TypeMap.find (id :> Ident.type_) s.class_type with
12941294+ | `Renamed (`LType _ as x) -> x
12951295+ | `Prefixed (_, _) -> Ident.Rename.type_ id
12961296+ with Not_found -> Ident.Rename.type_ id
99212979931298and removed_items s items =
9941299 let open Component.Signature in
995995- List.map
996996- (function
997997- | RModule (id, p) -> RModule (id, module_path s p)
998998- | RType (id, exp, eqn) ->
999999- RType (id, type_expr s exp, type_decl_equation s eqn)
10001000- | RModuleType (id, mty) -> RModuleType (id, module_type_expr s mty))
10011001- items
13001300+ list_sharing (fun s item ->
13011301+ match item with
13021302+ | RModule (id, p) ->
13031303+ let p' = module_path s p in
13041304+ if p' == p then item else RModule (id, p')
13051305+ | RType (id, exp, eqn) ->
13061306+ let exp' = type_expr s exp in
13071307+ let eqn' = type_decl_equation s eqn in
13081308+ if exp' == exp && eqn' == eqn then item else RType (id, exp', eqn')
13091309+ | RModuleType (id, mty) ->
13101310+ let mty' = module_type_expr s mty in
13111311+ if mty' == mty then item else RModuleType (id, mty')
13121312+ ) s items
1002131310031314and signature s sg =
13151315+ if is_identity s then sg
13161316+ else
10041317 let s, items = rename_bound_idents s [] sg.items in
10051318 let items, removed, dont_recompile = apply_sig_map s items sg.removed in
10061319 { sg with items; removed; compiled = sg.compiled && dont_recompile }
1007132010081321and apply_sig_map_sg s (sg : Component.Signature.t) =
13221322+ if is_identity s then sg
13231323+ else
10091324 let items, removed, dont_recompile = apply_sig_map s sg.items sg.removed in
10101325 { sg with items; removed; compiled = sg.compiled && dont_recompile }
10111326···10481363 List.rev_map (apply_sig_map_item s) items |> List.rev
1049136410501365and apply_sig_map s items removed =
13661366+ if is_identity s then (items, removed, true)
13671367+ else
10511368 let dont_recompile = List.length s.path_invalidating_modules = 0 in
10521369 (apply_sig_map_items s items, removed_items s removed, dont_recompile)
+304-463
odoc/src/xref2/tools.ml
···9696 | Type (id, _, _) :: rest ->
9797 let name = Ident.Name.typed_type id in
9898 get_sub
9999- (Subst.add_type id (`Type (path, name)) (`Type (path, name)) sub')
9999+ (Subst.add_type id (`Type (`U, path, name)) (`Type (path, name)) sub')
100100 rest
101101 | Module (id, _, _) :: rest ->
102102 let name = Ident.Name.typed_module id in
103103 get_sub
104104 (Subst.add_module
105105 (id :> Ident.module_)
106106- (`Module (path, name))
106106+ (`Module (`U, path, name))
107107 (`Module (path, name))
108108 sub')
109109 rest
···111111 let name = Ident.Name.typed_module_type id in
112112 get_sub
113113 (Subst.add_module_type id
114114- (`ModuleType (path, name))
114114+ (`ModuleType (`U, path, name))
115115 (`ModuleType (path, name))
116116 sub')
117117 rest
···119119 let name = Ident.Name.typed_module_type id in
120120 get_sub
121121 (Subst.add_module_type id
122122- (`ModuleType (path, name))
122122+ (`ModuleType (`U, path, name))
123123 (`ModuleType (path, name))
124124 sub')
125125 rest
···128128 get_sub
129129 (Subst.add_module
130130 (id :> Ident.module_)
131131- (`Module (path, name))
131131+ (`Module (`U, path, name))
132132 (`Module (path, name))
133133 sub')
134134 rest
135135 | TypeSubstitution (id, _) :: rest ->
136136 let name = Ident.Name.typed_type id in
137137 get_sub
138138- (Subst.add_type id (`Type (path, name)) (`Type (path, name)) sub')
138138+ (Subst.add_type id (`Type (`U, path, name)) (`Type (path, name)) sub')
139139 rest
140140 | Exception _ :: rest
141141 | TypExt _ :: rest
···145145 | Class (id, _, _) :: rest ->
146146 let name = Ident.Name.typed_type id in
147147 get_sub
148148- (Subst.add_class id (`Class (path, name)) (`Class (path, name)) sub')
148148+ (Subst.add_class id (`Type (`U, path, name)) (`Class (path, name)) sub')
149149 rest
150150 | ClassType (id, _, _) :: rest ->
151151 let name = Ident.Name.typed_type id in
152152 get_sub
153153 (Subst.add_class_type id
154154- (`ClassType (path, name))
154154+ (`Type (`U, path, name))
155155 (`ClassType (path, name))
156156 sub')
157157 rest
···314314end)
315315316316module HandleCanonicalModuleMemo = MakeMemo (struct
317317- type t = Odoc_model.Paths.Path.Module.t
317317+ type t = Cpath.module_
318318319319- type result = Odoc_model.Paths.Path.Module.t
319319+ type result = Cpath.module_
320320321321 let equal x3 y3 = x3 = y3
322322···350350 fun env m ->
351351 let open Odoc_model.Paths.Identifier in
352352 match m with
353353- | `Module (`Module (`Gpath (`Identifier p)), name) -> (
353353+ | `Module (`Module (`Identifier p), name) -> (
354354 let ident = (Mk.module_ ((p :> Signature.t), name) : Path.Module.t) in
355355 match Env.(lookup_by_id s_module (ident :> Signature.t) env) with
356356- | Some _ -> `Gpath (`Identifier ident)
356356+ | Some _ -> `Identifier ident
357357 | None -> m)
358358 | _ -> m
359359···362362 fun env m ->
363363 let open Odoc_model.Paths.Identifier in
364364 match m with
365365- | `ModuleType (`Module (`Gpath (`Identifier p)), name) -> (
365365+ | `ModuleType (`Module (`Identifier p), name) -> (
366366 let ident =
367367 (Mk.module_type ((p :> Signature.t), name) : Path.ModuleType.t)
368368 in
369369 match Env.(lookup_by_id s_module_type (ident :> Signature.t) env) with
370370- | Some _ -> `Gpath (`Identifier ident)
370370+ | Some _ -> `Identifier ident
371371 | None -> m)
372372 | _ -> m
373373···375375 fun env m ->
376376 let open Odoc_model.Paths.Identifier in
377377 match m with
378378- | `Type (`Module (`Gpath (`Identifier p)), name) -> (
378378+ | `Type (`Module (`Identifier p), name) -> (
379379 let ident = (Mk.type_ ((p :> Signature.t), name) : Path.Type.t) in
380380 match Env.(lookup_by_id s_datatype (ident :> Path.Type.t) env) with
381381- | Some _ -> `Gpath (`Identifier ident)
381381+ | Some _ -> `Identifier ident
382382 | None -> m)
383383 | _ -> m
384384···415415 | `Canonical _ -> p
416416 | _ -> (
417417 match m.Component.Module.canonical with
418418- | Some cp -> `Canonical (p, cp)
418418+ | Some cp -> `Canonical (p, (cp :> Cpath.module_))
419419 | None -> p)
420420421421and add_canonical_path_mt :
···427427 | `CanonicalModuleType _ -> p
428428 | _ -> (
429429 match m.canonical with
430430- | Some cp -> `CanonicalModuleType (p, cp)
430430+ | Some cp -> `CanonicalModuleType (p, (cp :> Cpath.module_type))
431431 | None -> p)
432432433433and get_substituted_module_type :
···495495 | None -> rp
496496 | Some (`Aliased rp') ->
497497 let dest_hidden =
498498- Cpath.is_resolved_module_hidden ~weak_canonical_test:true rp'
498498+ Cpath.is_resolved_hidden ~weak_canonical_test:true (rp' :> Cpath.Resolved.any)
499499 in
500500 if dest_hidden then rp
501501 else
···547547 | Some (`FType_removed (_name, _, _) as _t) -> Error `Class_replaced
548548 | None -> Error `Find_failure
549549550550-and lookup_module_gpath :
551551- Env.t ->
552552- Odoc_model.Paths.Path.Resolved.Module.t ->
553553- (Component.Module.t Component.Delayed.t, simple_module_lookup_error) result
554554- =
555555- fun env path ->
556556- match path with
557557- | `Identifier i ->
558558- of_option ~error:(`Lookup_failure i) (Env.(lookup_by_id s_module) i env)
559559- >>= fun (`Module (_, m)) -> Ok m
560560- | `Apply (functor_path, argument_path) ->
561561- lookup_module_gpath env functor_path >>= fun functor_module ->
562562- let functor_module = Component.Delayed.get functor_module in
563563- handle_apply env (`Gpath functor_path) (`Gpath argument_path)
564564- functor_module
565565- |> map_error (fun e -> `Parent (`Parent_expr e))
566566- >>= fun (_, m) -> Ok (Component.Delayed.put_val m)
567567- | `Module (parent, name) ->
568568- let find_in_sg sg sub =
569569- match Find.careful_module_in_sig sg name with
570570- | None -> Error `Find_failure
571571- | Some (`FModule (_, m)) ->
572572- Ok (Component.Delayed.put_val (Subst.module_ sub m))
573573- | Some (`FModule_removed p) ->
574574- resolve_module env p >>= fun (_, m) -> Ok m
575575- in
576576- lookup_parent_gpath env parent
577577- |> map_error (fun e -> (e :> simple_module_lookup_error))
578578- >>= fun (sg, sub) -> find_in_sg sg sub
579579- | `Alias (p, _) -> lookup_module_gpath env p
580580- | `Subst (_, p) -> lookup_module_gpath env p
581581- | `Hidden p -> lookup_module_gpath env p
582582- | `Canonical (p, _) -> lookup_module_gpath env p
583583- | `OpaqueModule m -> lookup_module_gpath env m
584584- | `Substituted m -> lookup_module_gpath env m
585585-586550and lookup_module :
587551 Env.t ->
588552 Cpath.Resolved.module_ ->
···591555 fun env' path' ->
592556 let lookup env (path : ExpansionOfModuleMemo.M.key) =
593557 match path with
594594- | `Local lpath -> Error (`Local (env, lpath))
595595- | `Gpath p -> lookup_module_gpath env p
558558+ | `LocalMod (`Na _) -> .
559559+ | `LocalMod (#Ident.module_ as lpath) -> Error (`Local (env, lpath))
560560+ | `Identifier p ->
561561+ of_option ~error:(`Lookup_failure p) (Env.(lookup_by_id s_module) p env)
562562+ >>= fun (`Module (_, m)) -> Ok m
596563 | `Substituted x -> lookup_module env x
597564 | `Apply (functor_path, argument_path) ->
598565 lookup_module env functor_path >>= fun functor_module ->
···623590 in
624591 LookupModuleMemo.memoize lookup env' path'
625592626626-and lookup_module_type_gpath :
627627- Env.t ->
628628- Odoc_model.Paths.Path.Resolved.ModuleType.t ->
629629- (Component.ModuleType.t, simple_module_type_lookup_error) result =
630630- fun env path ->
631631- match path with
632632- | `Identifier i ->
633633- of_option ~error:(`Lookup_failureMT i)
634634- (Env.(lookup_by_id s_module_type) i env)
635635- >>= fun (`ModuleType (_, mt)) -> Ok mt
636636- | `CanonicalModuleType (s, _) | `SubstT (_, s) ->
637637- lookup_module_type_gpath env s
638638- | `ModuleType (parent, name) ->
639639- let find_in_sg sg sub =
640640- match Find.module_type_in_sig sg name with
641641- | None -> Error `Find_failure
642642- | Some (`FModuleType (_, mt)) -> Ok (Subst.module_type sub mt)
643643- in
644644- lookup_parent_gpath env parent
645645- |> map_error (fun e -> (e :> simple_module_type_lookup_error))
646646- >>= fun (sg, sub) -> find_in_sg sg sub
647647- | `AliasModuleType (_, mt) -> lookup_module_type_gpath env mt
648648- | `OpaqueModuleType m -> lookup_module_type_gpath env m
649649- | `SubstitutedMT m -> lookup_module_type_gpath env m
650650-651593and lookup_module_type :
652594 Env.t ->
653595 Cpath.Resolved.module_type ->
···655597 fun env path ->
656598 let lookup env =
657599 match path with
658658- | `Local l -> Error (`LocalMT (env, l))
659659- | `Gpath p -> lookup_module_type_gpath env p
660660- | `Substituted s | `CanonicalModuleType (s, _) | `SubstT (_, s) ->
600600+ | `LocalModTy (`Na _) -> .
601601+ | `LocalModTy (#Ident.module_type as l) -> Error (`LocalMT (env, l))
602602+ | `Identifier i ->
603603+ of_option ~error:(`Lookup_failureMT i)
604604+ (Env.(lookup_by_id s_module_type) i env)
605605+ >>= fun (`ModuleType (_, mt)) -> Ok mt
606606+ | `SubstitutedMT s | `CanonicalModuleType (s, _) | `SubstT (_, s) ->
661607 lookup_module_type env s
662608 | `ModuleType (parent, name) ->
663609 let find_in_sg sg sub =
···680626 [ `Parent of parent_lookup_error ] )
681627 result =
682628 fun env' parent' ->
683683- let lookup env parent =
629629+ let lookup env (parent : Cpath.Resolved.parent) =
684630 match parent with
685631 | `Module p ->
686632 lookup_module env p |> map_error (fun e -> `Parent (`Parent_module e))
···690636 |> map_error (fun e -> `Parent (`Parent_sig e))
691637 >>= assert_not_functor
692638 >>= fun sg -> Ok (sg, prefix_substitution parent sg)
693693- | `ModuleType p ->
639639+ | `ModuleType (p, `U) ->
694640 lookup_module_type env p
695641 |> map_error (fun e -> `Parent (`Parent_module_type e))
696642 >>= fun mt ->
···698644 |> map_error (fun e -> `Parent (`Parent_sig e))
699645 >>= assert_not_functor
700646 >>= fun sg -> Ok (sg, prefix_substitution parent sg)
701701- | `FragmentRoot ->
647647+ | `FragmentRoot `U ->
702648 Env.lookup_fragment_root env
703649 |> of_option ~error:(`Parent `Fragment_root)
704650 >>= fun (_, sg) -> Ok (sg, prefix_substitution parent sg)
651651+ | `ModuleType (_, `Na _) -> .
652652+ | `FragmentRoot (`Na _) -> .
705653 in
706654 LookupParentMemo.memoize lookup env' parent'
707655708708-and lookup_parent_gpath :
709709- Env.t ->
710710- Odoc_model.Paths.Path.Resolved.Module.t ->
711711- ( Component.Signature.t * Component.Substitution.t,
712712- [ `Parent of parent_lookup_error ] )
713713- result =
714714- fun env parent ->
715715- lookup_module_gpath env parent
716716- |> map_error (fun e -> `Parent (`Parent_module e))
717717- >>= fun m ->
718718- let m = Component.Delayed.get m in
719719- expansion_of_module env m
720720- |> map_error (fun e -> `Parent (`Parent_sig e))
721721- >>= assert_not_functor
722722- >>= fun sg -> Ok (sg, prefix_substitution (`Module (`Gpath parent)) sg)
723723-724724-and lookup_type_gpath :
725725- Env.t ->
726726- Odoc_model.Paths.Path.Resolved.Type.t ->
727727- (Find.careful_type, simple_type_lookup_error) result =
728728- fun env p ->
729729- let do_type p name =
730730- lookup_parent_gpath env p
731731- |> map_error (fun e -> (e :> simple_type_lookup_error))
732732- >>= fun (sg, sub) ->
733733- match Find.careful_type_in_sig sg name with
734734- | Some (`FClass (name, c)) -> Ok (`FClass (name, Subst.class_ sub c))
735735- | Some (`FClassType (name, ct)) ->
736736- Ok (`FClassType (name, Subst.class_type sub ct))
737737- | Some (`FType (name, t)) -> Ok (`FType (name, Subst.type_ sub t))
738738- | Some (`FType_removed (name, texpr, eq)) ->
739739- Ok (`FType_removed (name, Subst.type_expr sub texpr, eq))
740740- | Some (`CoreType _ as c) -> Ok c
741741- | None -> Error `Find_failure
742742- in
743743- let res =
744744- match p with
745745- | `CoreType _ as c -> Ok c
746746- | `Identifier ({ iv = `Type _; _ } as i) ->
747747- of_option ~error:(`Lookup_failureT i)
748748- (Env.(lookup_by_id s_datatype) i env)
749749- >>= fun (`Type ({ iv = `Type (_, name); _ }, t)) ->
750750- Ok (`FType (name, t))
751751- | `Identifier ({ iv = `Class _; _ } as i) ->
752752- of_option ~error:(`Lookup_failureT i) (Env.(lookup_by_id s_class) i env)
753753- >>= fun (`Class ({ iv = `Class (_, name); _ }, t)) ->
754754- Ok (`FClass (name, t))
755755- | `Identifier ({ iv = `ClassType _; _ } as i) ->
756756- of_option ~error:(`Lookup_failureT i)
757757- (Env.(lookup_by_id s_class_type) i env)
758758- >>= fun (`ClassType ({ iv = `ClassType (_, name); _ }, t)) ->
759759- Ok (`FClassType (name, t))
760760- | `CanonicalType (t1, _) -> lookup_type_gpath env t1
761761- | `Type (p, id) -> do_type p id
762762- | `Class (p, id) -> do_type p id
763763- | `ClassType (p, id) -> do_type p id
764764- | `SubstitutedT t -> lookup_type_gpath env t
765765- | `SubstitutedCT t ->
766766- lookup_type_gpath env (t :> Odoc_model.Paths.Path.Resolved.Type.t)
767767- in
768768- res
769769-770770-and lookup_value_gpath :
771771- Env.t ->
772772- Odoc_model.Paths.Path.Resolved.Value.t ->
773773- (Find.value, simple_value_lookup_error) result =
774774- fun env p ->
775775- let do_value p name =
776776- lookup_parent_gpath env p
777777- |> map_error (fun e -> (e :> simple_value_lookup_error))
778778- >>= fun (sg, sub) ->
779779- match Find.value_in_sig sg name with
780780- | Some (`FValue (name, t)) -> Ok (`FValue (name, Subst.value sub t))
781781- | None -> Error `Find_failure
782782- in
783783- let res =
784784- match p with
785785- | `Identifier ({ iv = `Value _; _ } as i) ->
786786- of_option ~error:(`Lookup_failureV i) (Env.(lookup_by_id s_value) i env)
787787- >>= fun (`Value ({ iv = `Value (_, name); _ }, t)) ->
788788- Ok (`FValue (name, t))
789789- | `Value (p, id) -> do_value p id
790790- in
791791- res
792792-793793-and lookup_class_type_gpath :
794794- Env.t ->
795795- Odoc_model.Paths.Path.Resolved.ClassType.t ->
796796- (Find.careful_class, simple_type_lookup_error) result =
797797- fun env p ->
798798- let do_type p name =
799799- lookup_parent_gpath env p
800800- |> map_error (fun e -> (e :> simple_type_lookup_error))
801801- >>= fun (sg, sub) ->
802802- match Find.careful_class_in_sig sg name with
803803- | Some (`FClass (name, c)) -> Ok (`FClass (name, Subst.class_ sub c))
804804- | Some (`FClassType (name, ct)) ->
805805- Ok (`FClassType (name, Subst.class_type sub ct))
806806- | Some (`FType_removed (name, texpr, eq)) ->
807807- Ok (`FType_removed (name, Subst.type_expr sub texpr, eq))
808808- | None -> Error `Find_failure
809809- in
810810- let res =
811811- match p with
812812- | `Identifier ({ iv = `Class _; _ } as i) ->
813813- of_option ~error:(`Lookup_failureT i) (Env.(lookup_by_id s_class) i env)
814814- >>= fun (`Class ({ iv = `Class (_, name); _ }, t)) ->
815815- Ok (`FClass (name, t))
816816- | `Identifier ({ iv = `ClassType _; _ } as i) ->
817817- of_option ~error:(`Lookup_failureT i)
818818- (Env.(lookup_by_id s_class_type) i env)
819819- >>= fun (`ClassType ({ iv = `ClassType (_, name); _ }, t)) ->
820820- Ok (`FClassType (name, t))
821821- | `Class (p, id) -> do_type p id
822822- | `ClassType (p, id) -> do_type p id
823823- | `SubstitutedCT c -> lookup_class_type_gpath env c
824824- in
825825- res
826826-827656and lookup_type :
828657 Env.t ->
829658 Cpath.Resolved.type_ ->
···847676 let res =
848677 match p with
849678 | `CoreType _ as c -> Ok c
850850- | `Local id -> Error (`LocalType (env, id))
851851- | `Gpath p -> lookup_type_gpath env p
679679+ | `LocalTy (`Na _) -> .
680680+ | `LocalTy (#Ident.type_ as id) -> Error (`LocalType (env, id))
681681+ | `Identifier ({ iv = `Type _; _ } as i) ->
682682+ of_option ~error:(`Lookup_failureT i)
683683+ (Env.(lookup_by_id s_datatype) i env)
684684+ >>= fun (`Type ({ iv = `Type (_, name); _ }, t)) ->
685685+ Ok (`FType (name, t))
686686+ | `Identifier ({ iv = `Class _; _ } as i) ->
687687+ of_option ~error:(`Lookup_failureT i)
688688+ (Env.(lookup_by_id s_class) i env)
689689+ >>= fun (`Class ({ iv = `Class (_, name); _ }, t)) ->
690690+ Ok (`FClass (name, t))
691691+ | `Identifier ({ iv = `ClassType _; _ } as i) ->
692692+ of_option ~error:(`Lookup_failureT i)
693693+ (Env.(lookup_by_id s_class_type) i env)
694694+ >>= fun (`ClassType ({ iv = `ClassType (_, name); _ }, t)) ->
695695+ Ok (`FClassType (name, t))
852696 | `CanonicalType (t1, _) -> lookup_type env t1
853853- | `Substituted s -> lookup_type env s
697697+ | `SubstitutedT s -> lookup_type env s
698698+ | `SubstitutedCT s ->
699699+ lookup_class_type env s >>= fun ct -> Ok (ct :> Find.careful_type)
854700 | `Type (p, id) -> do_type p id
855701 | `Class (p, id) -> do_type p id
856702 | `ClassType (p, id) -> do_type p id
···867713 >>= fun (sg, sub) ->
868714 handle_value_lookup env id p sg >>= fun (_, `FValue (name, c)) ->
869715 Ok (`FValue (name, Subst.value sub c))
870870- | `Gpath p -> lookup_value_gpath env p
716716+ | `LocalVal (`Na _) -> .
717717+ | `LocalVal (#Ident.value as _id) -> failwith "Local value in lookup_value"
718718+ | `Identifier ({ iv = `Value _; _ } as i) ->
719719+ of_option ~error:(`Lookup_failureV i) (Env.(lookup_by_id s_value) i env)
720720+ >>= fun (`Value ({ iv = `Value (_, name); _ }, t)) ->
721721+ Ok (`FValue (name, t))
871722872723and lookup_class_type :
873724 Env.t ->
···889740 in
890741 let res =
891742 match p with
892892- | `Local id -> Error (`LocalType (env, (id :> Ident.type_)))
893893- | `Gpath p -> lookup_class_type_gpath env p
894894- | `Substituted s -> lookup_class_type env s
743743+ | `LocalTy (`Na _) -> .
744744+ | `LocalTy (#Ident.type_ as id) -> Error (`LocalType (env, id))
745745+ | `Identifier ({ iv = `Class _; _ } as i) ->
746746+ of_option ~error:(`Lookup_failureT i) (Env.(lookup_by_id s_class) i env)
747747+ >>= fun (`Class ({ iv = `Class (_, name); _ }, t)) ->
748748+ Ok (`FClass (name, t))
749749+ | `Identifier ({ iv = `ClassType _; _ } as i) ->
750750+ of_option ~error:(`Lookup_failureT i)
751751+ (Env.(lookup_by_id s_class_type) i env)
752752+ >>= fun (`ClassType ({ iv = `ClassType (_, name); _ }, t)) ->
753753+ Ok (`FClassType (name, t))
754754+ | `SubstitutedCT s -> lookup_class_type env s
895755 | `Class (p, id) -> do_type p id
896756 | `ClassType (p, id) -> do_type p id
897757 in
···919779 |> map_error (fun e -> (e :> simple_module_lookup_error))
920780 >>= fun (parent, parent_sig, sub) ->
921781 handle_module_lookup env id parent parent_sig sub
922922- | `Module (parent, id) ->
782782+ | `Module (_, parent, id) ->
923783 lookup_parent env parent
924784 |> map_error (fun e -> (e :> simple_module_lookup_error))
925785 >>= fun (parent_sig, sub) ->
···939799 of_option ~error:(`Lookup_failure i) (Env.(lookup_by_id s_module) i env)
940800 >>= fun (`Module (_, m)) ->
941801 let rp =
942942- if hidden then `Hidden (`Gpath (`Identifier i))
943943- else `Gpath (`Identifier i)
802802+ if hidden then `Hidden (`Identifier i)
803803+ else `Identifier i
944804 in
945805 Ok (process_module_path env (Component.Delayed.get m) rp, m)
946946- | `Local (p, _) -> Error (`Local (env, p))
806806+ | `LocalMod (`Na _) -> assert false
807807+ | `LocalMod (#Ident.module_ as p) -> Error (`Local (env, p))
947808 | `Resolved r -> lookup_module env r >>= fun m -> Ok (r, m)
948809 | `Substituted s ->
949810 resolve_module env s |> map_error (fun e -> `Parent (`Parent_module e))
···952813 match Env.lookup_root_module r env with
953814 | Some (Env.Resolved (_, p, m)) ->
954815 let p =
955955- `Gpath
956956- (`Identifier (p :> Odoc_model.Paths.Identifier.Path.Module.t))
816816+ `Identifier (p :> Odoc_model.Paths.Identifier.Path.Module.t)
957817 in
958818 let p = process_module_path env m p in
959819 Ok (p, Component.Delayed.put_val m)
···977837 of_option ~error:`Find_failure
978838 (handle_module_type_lookup env id parent parent_sig sub)
979839 >>= fun (p', mt) -> Ok (p', mt)
980980- | `ModuleType (parent, id) ->
840840+ | `ModuleType (_, parent, id) ->
981841 lookup_parent env parent
982842 |> map_error (fun e -> (e :> simple_module_type_lookup_error))
983843 >>= fun (parent_sig, sub) ->
···987847 of_option ~error:(`Lookup_failureMT i)
988848 (Env.(lookup_by_id s_module_type) i env)
989849 >>= fun (`ModuleType (_, mt)) ->
990990- let p = `Gpath (`Identifier i) in
850850+ let p = `Identifier i in
991851 let p' = process_module_type env mt p in
992852 Ok (p', mt)
993993- | `Local (l, _) -> Error (`LocalMT (env, l))
853853+ | `LocalModTy (`Na _) -> .
854854+ | `LocalModTy (#Ident.module_type as l) -> Error (`LocalMT (env, l))
994855 | `Resolved r -> lookup_module_type env r >>= fun m -> Ok (r, m)
995995- | `Substituted s ->
856856+ | `SubstitutedMT s ->
996857 resolve_module_type env s
997858 |> map_error (fun e -> `Parent (`Parent_module_type e))
998998- >>= fun (p, m) -> Ok (`Substituted p, m)
859859+ >>= fun (p, m) -> Ok (`SubstitutedMT p, m)
9998601000861and resolve_type : Env.t -> Cpath.type_ -> resolve_type_result =
1001862 fun env p ->
···1016877 `FType_removed (name, Subst.type_expr sub texpr, eq)
1017878 in
1018879 Ok (p', t)
10191019- | `Type (parent, id) ->
10201020- lookup_parent env parent
10211021- |> map_error (fun e -> (e :> simple_type_lookup_error))
10221022- >>= fun (parent_sig, sub) ->
10231023- let result =
10241024- match Find.datatype_in_sig parent_sig id with
10251025- | Some (`FType (name, t)) ->
10261026- Some (`Type (parent, name), `FType (name, Subst.type_ sub t))
10271027- | None -> None
10281028- in
10291029- of_option ~error:`Find_failure result
10301030- | `Class (parent, id) ->
10311031- lookup_parent env parent
10321032- |> map_error (fun e -> (e :> simple_type_lookup_error))
10331033- >>= fun (parent_sig, sub) ->
10341034- let t =
10351035- match Find.type_in_sig parent_sig id with
10361036- | Some (`FClass (name, t)) ->
10371037- Some (`Class (parent, name), `FClass (name, Subst.class_ sub t))
10381038- | Some _ -> None
10391039- | None -> None
10401040- in
10411041- of_option ~error:`Find_failure t
10421042- | `ClassType (parent, id) ->
880880+ | `Type (_, parent, id) ->
1043881 lookup_parent env parent
1044882 |> map_error (fun e -> (e :> simple_type_lookup_error))
1045883 >>= fun (parent_sg, sub) ->
···1056894 Ok (p', t)
1057895 | `Identifier (i, _) ->
1058896 let i' = `Identifier i in
10591059- lookup_type env (`Gpath i') >>= fun t -> Ok (`Gpath i', t)
897897+ lookup_type env i' >>= fun t -> Ok (i', t)
1060898 | `Resolved r -> lookup_type env r >>= fun t -> Ok (r, t)
10611061- | `Local (l, _) -> Error (`LocalType (env, l))
10621062- | `Substituted s ->
10631063- resolve_type env s >>= fun (p, m) -> Ok (`Substituted p, m)
899899+ | `LocalTy (`Na _) -> .
900900+ | `LocalTy (#Ident.type_ as l) -> Error (`LocalType (env, l))
901901+ | `SubstitutedT s ->
902902+ resolve_type env s >>= fun (p, m) -> Ok (`SubstitutedT p, m)
903903+ | `SubstitutedCT s ->
904904+ resolve_class_type env s >>= fun (p, m) -> Ok (`SubstitutedCT p, (m :> Find.careful_type))
1064905 in
1065906 result >>= fun (p, t) ->
1066907 match t with
10671067- | `FType (_, { canonical = Some c; _ }) -> Ok (`CanonicalType (p, c), t)
908908+ | `FType (_, { canonical = Some c; _ }) -> Ok (`CanonicalType (p, (c :> Cpath.type_)), t)
1068909 | _ -> result
10699101070911and resolve_value : Env.t -> Cpath.value -> resolve_value_result =
···1084925 handle_value_lookup env id (`Module p) sg
1085926 >>= fun (p', `FValue (name, c)) ->
1086927 Ok (p', `FValue (name, Subst.value sub c))
10871087- | `Value (parent, id) ->
10881088- lookup_parent env parent
10891089- |> map_error (fun e -> (e :> simple_value_lookup_error))
10901090- >>= fun (parent_sig, sub) ->
10911091- let result =
10921092- match Find.value_in_sig parent_sig id with
10931093- | Some (`FValue (name, t)) ->
10941094- Some (`Value (parent, name), `FValue (name, Subst.value sub t))
10951095- | None -> None
10961096- in
10971097- of_option ~error:`Find_failure result
928928+ | `LocalVal (`Na _) -> .
929929+ | `LocalVal (#Ident.value as _id) -> failwith "Local value in resolve_value"
1098930 | `Resolved r -> lookup_value env r >>= fun t -> Ok (r, t)
1099931 | `Identifier (i, _) ->
1100932 let i' = `Identifier i in
11011101- lookup_value env (`Gpath i') >>= fun t -> Ok (`Gpath i', t)
933933+ lookup_value env i' >>= fun t -> Ok (i', t)
1102934 in
1103935 result
1104936···1121953 Ok (p', t)
1122954 | `Identifier (i, _) ->
1123955 let i' = `Identifier i in
11241124- let id = `Gpath i' in
11251125- lookup_class_type env id >>= fun t -> Ok (id, t)
956956+ lookup_class_type env i' >>= fun t -> Ok (i', t)
1126957 | `Resolved r -> lookup_class_type env r >>= fun t -> Ok (r, t)
11271127- | `Local (l, _) -> Error (`LocalType (env, (l :> Ident.type_)))
11281128- | `Substituted s ->
11291129- resolve_class_type env s >>= fun (p, m) -> Ok (`Substituted p, m)
11301130- | `Class (parent, id) ->
11311131- lookup_parent env parent
11321132- |> map_error (fun e -> (e :> simple_type_lookup_error))
11331133- >>= fun (parent_sig, sub) ->
11341134- let t =
11351135- match Find.type_in_sig parent_sig id with
11361136- | Some (`FClass (name, t)) ->
11371137- Some (`Class (parent, name), `FClass (name, Subst.class_ sub t))
11381138- | Some _ -> None
11391139- | None -> None
11401140- in
11411141- of_option ~error:`Find_failure t
11421142- | `ClassType (parent, id) ->
958958+ | `LocalTy (`Na _) -> .
959959+ | `LocalTy (#Ident.type_ as l) -> Error (`LocalType (env, l))
960960+ | `SubstitutedCT s ->
961961+ resolve_class_type env s >>= fun (p, m) -> Ok (`SubstitutedCT p, m)
962962+ | `Type (_, parent, id) ->
1143963 lookup_parent env parent
1144964 |> map_error (fun e -> (e :> simple_type_lookup_error))
1145965 >>= fun (parent_sg, sub) ->
···1153973 in
1154974 Ok (p', t)
115597511561156-and reresolve_module_gpath :
11571157- Env.t ->
11581158- Odoc_model.Paths.Path.Resolved.Module.t ->
11591159- Odoc_model.Paths.Path.Resolved.Module.t =
11601160- fun env path ->
11611161- match path with
11621162- | `Identifier _ -> path
11631163- | `Apply (functor_path, argument_path) ->
11641164- `Apply
11651165- ( reresolve_module_gpath env functor_path,
11661166- reresolve_module_gpath env argument_path )
11671167- | `Module (parent, name) -> `Module (reresolve_module_gpath env parent, name)
11681168- | `Alias (p1, p2) ->
11691169- let dest' = reresolve_module_gpath env p1 in
11701170- if
11711171- Odoc_model.Paths.Path.Resolved.Module.is_hidden
11721172- ~weak_canonical_test:false dest'
11731173- then
11741174- let cp2 = Component.Of_Lang.(module_path (empty ()) p2) in
11751175- match resolve_module env cp2 with
11761176- | Ok (`Alias (_, _, Some p3), _) ->
11771177- let p = reresolve_module env p3 in
11781178- Lang_of.(Path.resolved_module (empty ()) p)
11791179- | _ -> `Alias (dest', p2)
11801180- else `Alias (dest', p2)
11811181- | `Subst (p1, p2) ->
11821182- `Subst (reresolve_module_type_gpath env p1, reresolve_module_gpath env p2)
11831183- | `Hidden p ->
11841184- let p' = reresolve_module_gpath env p in
11851185- `Hidden p'
11861186- | `Canonical (p, `Resolved p2) ->
11871187- `Canonical
11881188- (reresolve_module_gpath env p, `Resolved (reresolve_module_gpath env p2))
11891189- | `Canonical (p, p2) ->
11901190- `Canonical (reresolve_module_gpath env p, handle_canonical_module env p2)
11911191- | `OpaqueModule m -> `OpaqueModule (reresolve_module_gpath env m)
11921192- | `Substituted m -> `Substituted (reresolve_module_gpath env m)
11931193-1194976and strip_canonical :
11951195- c:Odoc_model.Paths.Path.Module.t ->
977977+ c:Cpath.module_ ->
1196978 Cpath.Resolved.module_ ->
1197979 Cpath.Resolved.module_ =
1198980 fun ~c path ->
···1204986 | `Hidden x -> `Hidden (strip_canonical ~c x)
1205987 | `OpaqueModule x -> `OpaqueModule (strip_canonical ~c x)
1206988 | `Substituted x -> `Substituted (strip_canonical ~c x)
12071207- | `Gpath p -> `Gpath (strip_canonical_gpath ~c p)
12081208- | `Local _ | `Apply _ | `Module _ -> path
12091209-12101210-and strip_canonical_gpath :
12111211- c:Odoc_model.Paths.Path.Module.t ->
12121212- Odoc_model.Paths.Path.Resolved.Module.t ->
12131213- Odoc_model.Paths.Path.Resolved.Module.t =
12141214- fun ~c path ->
12151215- match path with
12161216- | `Canonical (x, y) when y = c -> strip_canonical_gpath ~c x
12171217- | `Canonical (x, y) -> `Canonical (strip_canonical_gpath ~c x, y)
12181218- | `Alias (x, y) -> `Alias (strip_canonical_gpath ~c x, y)
12191219- | `Subst (x, y) -> `Subst (x, strip_canonical_gpath ~c y)
12201220- | `Hidden x -> `Hidden (strip_canonical_gpath ~c x)
12211221- | `OpaqueModule x -> `OpaqueModule (strip_canonical_gpath ~c x)
12221222- | `Apply _ | `Module _ | `Identifier _ -> path
12231223- | `Substituted x -> `Substituted (strip_canonical_gpath ~c x)
989989+ | `LocalMod _ | `Identifier _ | `Apply _ | `Module _ -> path
12249901225991and reresolve_module : Env.t -> Cpath.Resolved.module_ -> Cpath.Resolved.module_
1226992 =
1227993 fun env path ->
1228994 match path with
12291229- | `Local _ -> path
12301230- | `Gpath g -> `Gpath (reresolve_module_gpath env g)
12311231- | `Substituted x -> `Substituted (reresolve_module env x)
12321232- | `Apply (functor_path, argument_path) ->
12331233- `Apply
12341234- (reresolve_module env functor_path, reresolve_module env argument_path)
12351235- | `Module (parent, name) -> `Module (reresolve_parent env parent, name)
995995+ | `LocalMod _ | `Identifier _ -> path
996996+ | `Substituted x ->
997997+ let x' = reresolve_module env x in
998998+ if x' == x then path else `Substituted x'
999999+ | `Apply (p1, p2) ->
10001000+ let p1' = reresolve_module env p1 in
10011001+ let p2' = reresolve_module env p2 in
10021002+ if p1' == p1 && p2' == p2 then path else `Apply (p1', p2')
10031003+ | `Module (parent, name) ->
10041004+ let parent' = reresolve_parent env parent in
10051005+ if parent' == parent then path else `Module (parent', name)
12361006 | `Alias (p1, p2, p3opt) ->
12371007 let dest' = reresolve_module env p1 in
12381238- if Cpath.is_resolved_module_hidden ~weak_canonical_test:false dest' then
10081008+ if Cpath.is_resolved_hidden ~weak_canonical_test:false (dest' :> Cpath.Resolved.any) then
12391009 match p3opt with
12401010 | Some p3 -> reresolve_module env p3
12411011 | None -> (
12421012 match resolve_module env p2 with
12431013 | Ok (`Alias (_, _, Some p3), _) -> reresolve_module env p3
12441244- | _ -> `Alias (dest', p2, None))
12451245- else `Alias (dest', p2, p3opt)
10141014+ | _ ->
10151015+ if dest' == p1 then path
10161016+ else `Alias (dest', p2, None))
10171017+ else
10181018+ if dest' == p1 then path
10191019+ else `Alias (dest', p2, p3opt)
12461020 | `Subst (p1, p2) ->
12471247- `Subst (reresolve_module_type env p1, reresolve_module env p2)
10211021+ let p1' = reresolve_module_type env p1 in
10221022+ let p2' = reresolve_module env p2 in
10231023+ if p1' == p1 && p2' == p2 then path else `Subst (p1', p2')
12481024 | `Hidden p ->
12491025 let p' = reresolve_module env p in
12501250- `Hidden p'
10261026+ if p' == p then path else `Hidden p'
12511027 | `Canonical (p, `Resolved p2) ->
12521252- let cp2 = Component.Of_Lang.(resolved_module_path (empty ()) p2) in
12531253- let cp2' = reresolve_module env cp2 in
12541254- let p2' = Lang_of.(Path.resolved_module (empty ()) cp2') in
12551255- `Canonical (reresolve_module env p, `Resolved p2')
10281028+ let p' = reresolve_module env p in
10291029+ let p2' = reresolve_module env p2 in
10301030+ if p' == p && p2' == p2 then path
10311031+ else `Canonical (p', `Resolved p2')
12561032 | `Canonical (p, p2) -> (
12571033 match handle_canonical_module env p2 with
12581034 | `Resolved _ as r -> `Canonical (p, r)
12591259- | r -> `Canonical (reresolve_module env p, r))
12601260- | `OpaqueModule m -> `OpaqueModule (reresolve_module env m)
10351035+ | r ->
10361036+ let p' = reresolve_module env p in
10371037+ if p' == p && r == p2 then path
10381038+ else `Canonical (p', r))
10391039+ | `OpaqueModule m ->
10401040+ let m' = reresolve_module env m in
10411041+ if m' == m then path else `OpaqueModule m'
1261104212621043and handle_canonical_module_real env p2 =
12631044 (* Canonical paths are always fully qualified, but this isn't
···13171098 :> Odoc_model.Paths.Path.Resolved.t)
13181099 in
1319110013201320- let cp2 = Component.Of_Lang.(module_path (empty ()) p2) in
13211321- match canonical_helper env resolve lang_of c_mod_poss cp2 with
11011101+ match canonical_helper env resolve lang_of c_mod_poss p2 with
13221102 | None -> p2
13231103 | Some (rp, m) ->
13241104 let m = Component.Delayed.get m in
···13511131 let rec check m =
13521132 match m.Component.Module.canonical with
13531133 | Some p ->
13541354- p = p2
11341134+ (p :> Cpath.module_) = p2
13551135 (* The canonical path is the same one we're trying to resolve *)
13561136 | None -> (
13571137 match m.type_ with
···13691149 in
13701150 let self_canonical () = check m in
13711151 let hidden =
13721372- Cpath.is_resolved_module_hidden ~weak_canonical_test:true
13731373- (strip rp)
11521152+ Cpath.is_resolved_hidden ~weak_canonical_test:true
11531153+ (strip rp :> Cpath.Resolved.any)
13741154 in
13751155 hidden || self_canonical ()
13761156 | _ -> false)
···13791159 let cpath = if expanded then rp else process_module_path env m rp in
1380116013811161 (* Format.eprintf "result: %a\n%!" Component.Fmt.resolved_module_path cpath; *)
13821382- Lang_of.(Path.module_ (empty ()) (`Resolved cpath))
11621162+ `Resolved cpath
1383116313841164and handle_canonical_module env p2 =
13851165 HandleCanonicalModuleMemo.memoize handle_canonical_module_real env p2
1386116613871167and handle_canonical_module_type env p2 =
13881388- let cp2 = Component.Of_Lang.(module_type_path (empty ()) p2) in
13891168 let rec strip : Cpath.Resolved.module_type -> Cpath.Resolved.module_type =
13901169 function
13911170 | `AliasModuleType (_, p) -> strip p
···14021181 (Lang_of.(Path.resolved_module_type (empty ()) cpath)
14031182 :> Odoc_model.Paths.Path.Resolved.t)
14041183 in
14051405- match canonical_helper env resolve lang_of c_modty_poss cp2 with
11841184+ match canonical_helper env resolve lang_of c_modty_poss p2 with
14061185 | None -> p2
14071407- | Some (rp, _) -> `Resolved Lang_of.(Path.resolved_module_type (empty ()) rp)
11861186+ | Some (rp, _) -> `Resolved rp
1408118714091188and handle_canonical_type env p2 =
14101410- let cp2 = Component.Of_Lang.(type_path (empty ()) p2) in
14111189 let lang_of cpath =
14121190 (Lang_of.(Path.resolved_type (empty ()) cpath)
14131191 :> Odoc_model.Paths.Path.Resolved.t)
···14261204 Ok (r, y)
14271205 | Error y -> Error y
14281206 in
14291429- match canonical_helper env resolve lang_of c_ty_poss cp2 with
12071207+ match canonical_helper env resolve lang_of c_ty_poss p2 with
14301208 | None -> p2
14311431- | Some (rp, _) -> `Resolved Lang_of.(Path.resolved_type (empty ()) rp)
14321432-14331433-and reresolve_module_type_gpath :
14341434- Env.t ->
14351435- Odoc_model.Paths.Path.Resolved.ModuleType.t ->
14361436- Odoc_model.Paths.Path.Resolved.ModuleType.t =
14371437- fun env path ->
14381438- match path with
14391439- | `Identifier _ -> path
14401440- | `ModuleType (parent, name) ->
14411441- `ModuleType (reresolve_module_gpath env parent, name)
14421442- | `CanonicalModuleType (p1, (`Resolved _ as p2)) ->
14431443- `CanonicalModuleType (reresolve_module_type_gpath env p1, p2)
14441444- | `CanonicalModuleType (p1, p2) ->
14451445- `CanonicalModuleType
14461446- (reresolve_module_type_gpath env p1, handle_canonical_module_type env p2)
14471447- | `SubstT (p1, p2) ->
14481448- `SubstT
14491449- (reresolve_module_type_gpath env p1, reresolve_module_type_gpath env p2)
14501450- | `AliasModuleType (p1, p2) ->
14511451- `AliasModuleType
14521452- (reresolve_module_type_gpath env p1, reresolve_module_type_gpath env p2)
14531453- | `OpaqueModuleType m -> `OpaqueModuleType (reresolve_module_type_gpath env m)
14541454- | `SubstitutedMT m -> `SubstitutedMT (reresolve_module_type_gpath env m)
12091209+ | Some (rp, _) -> `Resolved rp
1455121014561211and reresolve_module_type :
14571212 Env.t -> Cpath.Resolved.module_type -> Cpath.Resolved.module_type =
14581213 fun env path ->
14591214 match path with
14601460- | `Local _ -> path
14611461- | `Gpath g -> `Gpath (reresolve_module_type_gpath env g)
14621462- | `Substituted x -> `Substituted (reresolve_module_type env x)
14631463- | `ModuleType (parent, name) -> `ModuleType (reresolve_parent env parent, name)
12151215+ | `LocalModTy _ | `Identifier _ -> path
12161216+ | `SubstitutedMT x ->
12171217+ let x' = reresolve_module_type env x in
12181218+ if x' == x then path else `SubstitutedMT x'
12191219+ | `ModuleType (parent, name) ->
12201220+ let parent' = reresolve_parent env parent in
12211221+ if parent' == parent then path else `ModuleType (parent', name)
14641222 | `CanonicalModuleType (p1, (`Resolved _ as p2')) ->
14651465- `CanonicalModuleType (reresolve_module_type env p1, p2')
12231223+ let p1' = reresolve_module_type env p1 in
12241224+ if p1' == p1 then path else `CanonicalModuleType (p1', p2')
14661225 | `CanonicalModuleType (p1, p2) ->
14671467- `CanonicalModuleType
14681468- (reresolve_module_type env p1, handle_canonical_module_type env p2)
12261226+ let p1' = reresolve_module_type env p1 in
12271227+ let p2' = handle_canonical_module_type env p2 in
12281228+ if p1' == p1 && p2' == p2 then path
12291229+ else `CanonicalModuleType (p1', p2')
14691230 | `SubstT (p1, p2) ->
14701470- `SubstT (reresolve_module_type env p1, reresolve_module_type env p2)
12311231+ let p1' = reresolve_module_type env p1 in
12321232+ let p2' = reresolve_module_type env p2 in
12331233+ if p1' == p1 && p2' == p2 then path else `SubstT (p1', p2')
14711234 | `AliasModuleType (p1, p2) ->
14721472- `AliasModuleType
14731473- (reresolve_module_type env p1, reresolve_module_type env p2)
14741474- | `OpaqueModuleType m -> `OpaqueModuleType (reresolve_module_type env m)
12351235+ let p1' = reresolve_module_type env p1 in
12361236+ let p2' = reresolve_module_type env p2 in
12371237+ if p1' == p1 && p2' == p2 then path else `AliasModuleType (p1', p2')
12381238+ | `OpaqueModuleType m ->
12391239+ let m' = reresolve_module_type env m in
12401240+ if m' == m then path else `OpaqueModuleType m'
1475124114761242and reresolve_type : Env.t -> Cpath.Resolved.type_ -> Cpath.Resolved.type_ =
14771243 fun env path ->
14781478- let result =
14791479- match path with
14801480- | `Gpath _ | `Local _ | `CoreType _ -> path
14811481- | `Substituted s -> `Substituted (reresolve_type env s)
14821482- | `CanonicalType (p1, p2) ->
14831483- `CanonicalType (reresolve_type env p1, handle_canonical_type env p2)
14841484- | `Type (p, n) -> `Type (reresolve_parent env p, n)
14851485- | `Class (p, n) -> `Class (reresolve_parent env p, n)
14861486- | `ClassType (p, n) -> `ClassType (reresolve_parent env p, n)
14871487- in
14881488- result
12441244+ match path with
12451245+ | `Identifier _ | `LocalTy _ | `CoreType _ -> path
12461246+ | `SubstitutedT s ->
12471247+ let s' = reresolve_type env s in
12481248+ if s' == s then path else `SubstitutedT s'
12491249+ | `SubstitutedCT s ->
12501250+ let s' = reresolve_class_type env s in
12511251+ if s' == s then path else `SubstitutedCT s'
12521252+ | `CanonicalType (p1, p2) ->
12531253+ let p1' = reresolve_type env p1 in
12541254+ let p2' = handle_canonical_type env p2 in
12551255+ if p1' == p1 && p2' == p2 then path
12561256+ else `CanonicalType (p1', p2')
12571257+ | `Type (parent, n) ->
12581258+ let parent' = reresolve_parent env parent in
12591259+ if parent' == parent then path else `Type (parent', n)
12601260+ | `Class (parent, n) ->
12611261+ let parent' = reresolve_parent env parent in
12621262+ if parent' == parent then path else `Class (parent', n)
12631263+ | `ClassType (parent, n) ->
12641264+ let parent' = reresolve_parent env parent in
12651265+ if parent' == parent then path else `ClassType (parent', n)
1489126614901267and reresolve_value : Env.t -> Cpath.Resolved.value -> Cpath.Resolved.value =
14911268 fun env p ->
14921269 match p with
14931493- | `Value (p, n) -> `Value (reresolve_parent env p, n)
14941494- | `Gpath _ -> p
12701270+ | `Value (parent, n) ->
12711271+ let parent' = reresolve_parent env parent in
12721272+ if parent' == parent then p else `Value (parent', n)
12731273+ | `Identifier _ | `LocalVal _ -> p
1495127414961275and reresolve_class_type :
14971276 Env.t -> Cpath.Resolved.class_type -> Cpath.Resolved.class_type =
14981277 fun env path ->
14991499- let result =
15001500- match path with
15011501- | `Gpath _ | `Local _ -> path
15021502- | `Substituted s -> `Substituted (reresolve_class_type env s)
15031503- | `Class (p, n) -> `Class (reresolve_parent env p, n)
15041504- | `ClassType (p, n) -> `ClassType (reresolve_parent env p, n)
15051505- in
15061506- result
12781278+ match path with
12791279+ | `Identifier _ | `LocalTy _ -> path
12801280+ | `SubstitutedCT s ->
12811281+ let s' = reresolve_class_type env s in
12821282+ if s' == s then path else `SubstitutedCT s'
12831283+ | `Class (parent, n) ->
12841284+ let parent' = reresolve_parent env parent in
12851285+ if parent' == parent then path else `Class (parent', n)
12861286+ | `ClassType (parent, n) ->
12871287+ let parent' = reresolve_parent env parent in
12881288+ if parent' == parent then path else `ClassType (parent', n)
1507128915081290and reresolve_parent : Env.t -> Cpath.Resolved.parent -> Cpath.Resolved.parent =
15091291 fun env path ->
15101292 match path with
15111511- | `Module m -> `Module (reresolve_module env m)
15121512- | `ModuleType mty -> `ModuleType (reresolve_module_type env mty)
15131513- | `FragmentRoot -> path
12931293+ | `Module m ->
12941294+ let m' = reresolve_module env m in
12951295+ if m' == m then path else `Module m'
12961296+ | `ModuleType (mty, pty) ->
12971297+ let mty' = reresolve_module_type env mty in
12981298+ if mty' == mty then path else `ModuleType (mty', pty)
12991299+ | `FragmentRoot _ -> path
1514130015151301(* *)
15161302and module_type_expr_of_module_decl :
···15541340 (* p' is the path to the aliased module *)
15551341 let strengthen =
15561342 strengthen
15571557- && not (Cpath.is_resolved_module_hidden ~weak_canonical_test:true p')
13431343+ && not (Cpath.is_resolved_hidden ~weak_canonical_test:true (p' :> Cpath.Resolved.any))
15581344 in
15591345 expansion_of_module_cached env p' m >>= function
15601346 | Signature sg ->
···18221608 | `RModuleType (id, x) -> RModuleType (Ident.Name.typed_module_type id, x)
18231609 in
1824161016111611+ (* Check whether the target name exists in a list of signature items,
16121612+ recursing into includes. This is a cheap scan that avoids the expensive
16131613+ [List.fold_right] rebuild when the name isn't present — which is the
16141614+ common case for deeply nested include chains. *)
16151615+ let rec name_exists_in_items map items =
16161616+ List.exists
16171617+ (fun item ->
16181618+ match (item, map) with
16191619+ | Component.Signature.Type (id, _, _), { type_ = Some (id', _); _ } ->
16201620+ Ident.Name.type_ id = id'
16211621+ | Component.Signature.Module (id, _, _), { module_ = Some (id', _); _ }
16221622+ ->
16231623+ Ident.Name.module_ id = id'
16241624+ | Component.Signature.ModuleType (id, _),
16251625+ { module_type = Some (id', _); _ } ->
16261626+ Ident.Name.module_type id = id'
16271627+ | Component.Signature.Include { expansion_; _ }, _ ->
16281628+ name_exists_in_items map expansion_.items
16291629+ | _ -> false)
16301630+ items
16311631+ in
16321632+18251633 let rec map_signature map items =
16341634+ if not (name_exists_in_items map items) then
16351635+ Ok (items, false, [], [])
16361636+ else
18261637 List.fold_right
18271638 (fun item acc ->
18281639 acc >>= fun (items, handled, subbed_modules, removed) ->
···20451856 find_external_module_path y >>= fun y -> Some (`Subst (x, y))
20461857 | `Module (p, n) ->
20471858 find_external_parent_path p >>= fun p -> Some (`Module (p, n))
20482048- | `Local x -> Some (`Local x)
18591859+ | `LocalMod x -> Some (`LocalMod x)
18601860+ | `Identifier _ as x -> Some x
20491861 | `Substituted x ->
20501862 find_external_module_path x >>= fun x -> Some (`Substituted x)
20511863 | `Canonical (x, y) ->
···20551867 | `Apply (x, y) ->
20561868 find_external_module_path x >>= fun x ->
20571869 find_external_module_path y >>= fun y -> Some (`Apply (x, y))
20582058- | `Gpath x -> Some (`Gpath x)
20591870 | `OpaqueModule m ->
20601871 find_external_module_path m >>= fun x -> Some (`OpaqueModule x)
20611872···20661877 match p with
20671878 | `ModuleType (p, name) ->
20681879 find_external_parent_path p >>= fun p -> Some (`ModuleType (p, name))
20692069- | `Local _ -> Some p
18801880+ | `LocalModTy _ | `Identifier _ -> Some p
20701881 | `SubstT (x, y) ->
20711882 find_external_module_type_path x >>= fun x ->
20721883 find_external_module_type_path y >>= fun y -> Some (`SubstT (x, y))
20732073- | `CanonicalModuleType (x, _) | `Substituted x ->
20742074- find_external_module_type_path x >>= fun x -> Some (`Substituted x)
20752075- | `Gpath _ -> Some p
18841884+ | `CanonicalModuleType (x, _) | `SubstitutedMT x ->
18851885+ find_external_module_type_path x >>= fun x -> Some (`SubstitutedMT x)
20761886 | `AliasModuleType (x, y) -> (
20771887 match
20781888 (find_external_module_type_path x, find_external_module_type_path y)
···20901900 let open Odoc_utils.OptionMonad in
20911901 match p with
20921902 | `Module m -> find_external_module_path m >>= fun m -> Some (`Module m)
20932093- | `ModuleType m ->
20942094- find_external_module_type_path m >>= fun m -> Some (`ModuleType m)
20952095- | `FragmentRoot -> None
19031903+ | `ModuleType (m, pty) ->
19041904+ find_external_module_type_path m >>= fun m -> Some (`ModuleType (m, pty))
19051905+ | `FragmentRoot _ -> None
2096190620971907and fixup_module_cfrag (f : Cfrag.resolved_module) : Cfrag.resolved_module =
20981908 match f with
···21041914 match find_external_module_path path with
21051915 | Some p -> `Alias (p, frag)
21061916 | None -> frag)
21072107- | `Module (parent, name) -> `Module (fixup_signature_cfrag parent, name)
21082108- | `OpaqueModule m -> `OpaqueModule (fixup_module_cfrag m)
19171917+ | `Module (parent, name) ->
19181918+ let parent' = fixup_signature_cfrag parent in
19191919+ if parent' == parent then f else `Module (parent', name)
19201920+ | `OpaqueModule m ->
19211921+ let m' = fixup_module_cfrag m in
19221922+ if m' == m then f else `OpaqueModule m'
2109192321101924and fixup_module_type_cfrag (f : Cfrag.resolved_module_type) :
21111925 Cfrag.resolved_module_type =
21121926 match f with
21131927 | `ModuleType (parent, name) ->
21142114- `ModuleType (fixup_signature_cfrag parent, name)
19281928+ let parent' = fixup_signature_cfrag parent in
19291929+ if parent' == parent then f else `ModuleType (parent', name)
2115193021161931and fixup_signature_cfrag (f : Cfrag.resolved_signature) =
21171932 match f with
21182118- | `Root x -> `Root x
21192119- | (`OpaqueModule _ | `Subst _ | `Alias _ | `Module _) as f ->
21202120- (fixup_module_cfrag f :> Cfrag.resolved_signature)
19331933+ | `Root _ -> f
19341934+ | (`OpaqueModule _ | `Subst _ | `Alias _ | `Module _) as m ->
19351935+ let m' = fixup_module_cfrag m in
19361936+ if m' == m then f else (m' :> Cfrag.resolved_signature)
2121193721221938and fixup_type_cfrag (f : Cfrag.resolved_type) : Cfrag.resolved_type =
21231939 match f with
21242124- | `Type (p, x) -> `Type (fixup_signature_cfrag p, x)
21252125- | `Class (p, x) -> `Class (fixup_signature_cfrag p, x)
21262126- | `ClassType (p, x) -> `ClassType (fixup_signature_cfrag p, x)
19401940+ | `Type (p, x) ->
19411941+ let p' = fixup_signature_cfrag p in
19421942+ if p' == p then f else `Type (p', x)
19431943+ | `Class (p, x) ->
19441944+ let p' = fixup_signature_cfrag p in
19451945+ if p' == p then f else `Class (p', x)
19461946+ | `ClassType (p, x) ->
19471947+ let p' = fixup_signature_cfrag p in
19481948+ if p' == p then f else `ClassType (p', x)
2127194921281950and find_module_with_replacement :
21291951 Env.t ->
···21601982 fun env (p, sg) frag ->
21611983 match frag with
21621984 | `Root ->
21632163- let sg = prefix_signature (`FragmentRoot, sg) in
21642164- Some (`Root p, `FragmentRoot, sg)
19851985+ let sg = prefix_signature (`FragmentRoot `U, sg) in
19861986+ Some (`Root p, `FragmentRoot `U, sg)
21651987 | `Resolved _r -> None
21661988 | `Dot (parent, name) ->
21671989 let open Odoc_utils.OptionMonad in
···22732095 Env.t -> Cfrag.resolved_signature -> Cfrag.resolved_signature =
22742096 fun env m ->
22752097 match m with
22762276- | `Root (`ModuleType p) -> `Root (`ModuleType (reresolve_module_type env p))
22772277- | `Root (`Module p) -> `Root (`Module (reresolve_module env p))
20982098+ | `Root (`ModuleType p) ->
20992099+ let p' = reresolve_module_type env p in
21002100+ if p' == p then m else `Root (`ModuleType p')
21012101+ | `Root (`Module p) ->
21022102+ let p' = reresolve_module env p in
21032103+ if p' == p then m else `Root (`Module p')
22782104 | (`OpaqueModule _ | `Subst _ | `Alias _ | `Module _) as x ->
22792279- (reresolve_module_fragment env x :> Cfrag.resolved_signature)
21052105+ let x' = reresolve_module_fragment env x in
21062106+ if x' == x then m else (x' :> Cfrag.resolved_signature)
2280210722812108and reresolve_module_fragment :
22822109 Env.t -> Cfrag.resolved_module -> Cfrag.resolved_module =
···22842111 match m with
22852112 | `Subst (p, f) ->
22862113 let p' = reresolve_module_type env p in
22872287- `Subst (p', reresolve_module_fragment env f)
21142114+ let f' = reresolve_module_fragment env f in
21152115+ if p' == p && f' == f then m else `Subst (p', f')
22882116 | `Alias (p, f) ->
22892117 let p' = reresolve_module env p in
22902290- `Alias (p', reresolve_module_fragment env f)
22912291- | `OpaqueModule m -> `OpaqueModule (reresolve_module_fragment env m)
22922292- | `Module (sg, m) -> `Module (reresolve_signature_fragment env sg, m)
21182118+ let f' = reresolve_module_fragment env f in
21192119+ if p' == p && f' == f then m else `Alias (p', f')
21202120+ | `OpaqueModule x ->
21212121+ let x' = reresolve_module_fragment env x in
21222122+ if x' == x then m else `OpaqueModule x'
21232123+ | `Module (sg, n) ->
21242124+ let sg' = reresolve_signature_fragment env sg in
21252125+ if sg' == sg then m else `Module (sg', n)
2293212622942127and reresolve_type_fragment :
22952128 Env.t -> Cfrag.resolved_type -> Cfrag.resolved_type =
22962129 fun env m ->
22972130 match m with
22982298- | `Type (p, n) -> `Type (reresolve_signature_fragment env p, n)
22992299- | `ClassType (p, n) -> `ClassType (reresolve_signature_fragment env p, n)
23002300- | `Class (p, n) -> `Class (reresolve_signature_fragment env p, n)
21312131+ | `Type (p, n) ->
21322132+ let p' = reresolve_signature_fragment env p in
21332133+ if p' == p then m else `Type (p', n)
21342134+ | `ClassType (p, n) ->
21352135+ let p' = reresolve_signature_fragment env p in
21362136+ if p' == p then m else `ClassType (p', n)
21372137+ | `Class (p, n) ->
21382138+ let p' = reresolve_signature_fragment env p in
21392139+ if p' == p then m else `Class (p', n)
2301214023022141and reresolve_module_type_fragment :
23032142 Env.t -> Cfrag.resolved_module_type -> Cfrag.resolved_module_type =
23042143 fun env m ->
23052144 match m with
23062306- | `ModuleType (p, n) -> `ModuleType (reresolve_signature_fragment env p, n)
21452145+ | `ModuleType (p, n) ->
21462146+ let p' = reresolve_signature_fragment env p in
21472147+ if p' == p then m else `ModuleType (p', n)
2307214823082149let rec class_signature_of_class :
23092150 Env.t -> Component.Class.t -> Component.ClassSignature.t option =
···23332174let resolve_module_path env p =
23342175 resolve_module env p >>= fun (p, m) ->
23352176 match p with
23362336- | `Gpath (`Identifier { iv = `Root _; _ })
23372337- | `Hidden (`Gpath (`Identifier { iv = `Root _; _ })) ->
21772177+ | `Identifier { iv = `Root _; _ }
21782178+ | `Hidden (`Identifier { iv = `Root _; _ }) ->
23382179 Ok p
23392180 | _ -> (
23402181 let m = Component.Delayed.get m in
···23842225 let rp =
23852226 match modsubst.manifest with
23862227 | `Resolved rp -> rp
23872387- | `Local (local_id, _) -> (`Local local_id : Cpath.Resolved.module_)
22282228+ | `LocalMod local_id -> (`LocalMod local_id : Cpath.Resolved.module_)
23882229 | p ->
23892230 failwith
23902231 (Format.asprintf
+9
odoc/test/occurrences/double_wrapped.t/run.t
···125125 Main.A.M was used directly 2 times and indirectly 0 times
126126 Main.A.t was used directly 1 times and indirectly 0 times
127127 Main.A.x was used directly 1 times and indirectly 0 times
128128+ Main__ was used directly 0 times and indirectly 2 times
129129+ Main__.C was used directly 1 times and indirectly 1 times
130130+ Main__.C.y was used directly 1 times and indirectly 0 times
128131129132 $ odoc count-occurrences . -o all.odoc-occurrences --include-hidden
130133 $ occurrences_print all.odoc-occurrences | sort
···135138 Main.A.t was used directly 1 times and indirectly 0 times
136139 Main.A.x was used directly 2 times and indirectly 0 times
137140 Main.B was used directly 1 times and indirectly 0 times
141141+ Main__ was used directly 0 times and indirectly 2 times
142142+ Main__.C was used directly 1 times and indirectly 1 times
143143+ Main__.C.y was used directly 1 times and indirectly 0 times
144144+ Main__A was used directly 1 times and indirectly 0 times
145145+ Main__B was used directly 1 times and indirectly 0 times
146146+ Main__C was used directly 1 times and indirectly 0 times
138147139148We can use the generated table when generating the json output:
140149
+2-3
odoc/test/search/html_search.t/run.t
···216216217217 $ odoc compile-index --root babar
218218 $ odoc compile-index --file-list babar
219219- odoc: option '--file-list': no 'babar' file or directory
220220- Usage: odoc compile-index [OPTION]… [FILE]…
221221- Try 'odoc compile-index --help' or 'odoc --help' for more information.
219219+ Usage: odoc compile-index [--help] [OPTION]… [FILE]…
220220+ odoc: option --file-list: no babar file or directory
222221 [2]
223222224223Passing an empty folder is allowed:
+3-3
odoc/test/sources/lookup_def.t/run.t
···66 $ odoc compile -I . a.cmti
7788 $ odoc link -I . src-a.odoc
99- odoc: FILE.odoc argument: no 'src-a.odoc' file or directory
1010- Usage: odoc link [--custom-layout] [--open=MODULE] [OPTION]… FILE.odoc
1111- Try 'odoc link --help' or 'odoc --help' for more information.
99+ Usage: odoc link [--help] [--custom-layout] [--open=MODULE] [OPTION]…
1010+ FILE.odoc
1111+ odoc: FILE.odoc argument: no src-a.odoc file or directory
1212 [2]
1313 $ odoc link -I . a.odoc
1414
+5-9
odoc/test/sources/source.t/run.t
···387387Html generation for implementation and mld/interface uses different commands
388388389389 $ odoc html-generate-source --indent -o html a.odocl
390390+ Usage: odoc html-generate-source [--help] [OPTION]… FILE.ml
390391 odoc: required option --impl is missing
391391- Usage: odoc html-generate-source [OPTION]… FILE.ml
392392- Try 'odoc html-generate-source --help' or 'odoc --help' for more information.
393392 [2]
394393 $ odoc html-generate-source --indent -o html --impl a.odocl a.ml
395394 ERROR: Expected an implementation unit
396395 [1]
397396 $ odoc html-generate-source --indent -o html --impl impl-a.odocl
397397+ Usage: odoc html-generate-source [--help] [OPTION]… FILE.ml
398398 odoc: required argument FILE.ml is missing
399399- Usage: odoc html-generate-source [OPTION]… FILE.ml
400400- Try 'odoc html-generate-source --help' or 'odoc --help' for more information.
401399 [2]
402400 $ odoc html-generate-source --indent -o html a.ml
401401+ Usage: odoc html-generate-source [--help] [OPTION]… FILE.ml
403402 odoc: required option --impl is missing
404404- Usage: odoc html-generate-source [OPTION]… FILE.ml
405405- Try 'odoc html-generate-source --help' or 'odoc --help' for more information.
406403 [2]
407404 $ odoc html-generate --source a.ml --indent -o html impl-a.odocl
408408- odoc: unknown option '--source'.
409409- Usage: odoc html-generate [OPTION]… FILE.odocl…
410410- Try 'odoc html-generate --help' or 'odoc --help' for more information.
405405+ Usage: odoc html-generate [--help] [OPTION]… FILE.odocl…
406406+ odoc: unknown option --source
411407 [2]
412408413409Compiling without --source-id makes it impossible to generate the source: