this repo has no description

tidy paths

+184 -809
+4 -8
src/document/url.ml
··· 23 23 | `Subst (_, p) -> render_resolved (p :> t) 24 24 | `SubstT (_, p) -> render_resolved (p :> t) 25 25 | `Alias (dest, `Resolved src) -> 26 - if 27 - Odoc_model.Paths.Path.Resolved.Module.is_hidden 28 - ~weak_canonical_test:false src 29 - then render_resolved (dest :> t) 26 + if Odoc_model.Paths.Path.Resolved.(is_hidden (src :> t)) then 27 + render_resolved (dest :> t) 30 28 else render_resolved (src :> t) 31 29 | `Alias (dest, src) -> 32 30 if Odoc_model.Paths.Path.is_hidden (src :> Path.t) then 33 31 render_resolved (dest :> t) 34 32 else render_path (src :> Path.t) 35 33 | `AliasModuleType (p1, p2) -> 36 - if 37 - Odoc_model.Paths.Path.Resolved.ModuleType.is_hidden 38 - ~weak_canonical_test:false p2 39 - then render_resolved (p1 :> t) 34 + if Odoc_model.Paths.Path.Resolved.(is_hidden (p2 :> t)) then 35 + render_resolved (p1 :> t) 40 36 else render_resolved (p2 :> t) 41 37 | `Hidden p -> render_resolved (p :> t) 42 38 | `Module (p, s) -> render_resolved (p :> t) ^ "." ^ ModuleName.to_string s
+93 -459
src/model/paths.ml
··· 22 22 module Identifier = struct 23 23 type 'a id = 'a Paths_types.id = { iv : 'a; ihash : int; ikey : string } 24 24 25 - type t = Paths_types.Identifier.any 25 + module Id = Paths_types.Identifier 26 26 27 - type t_pv = Paths_types.Identifier.any_pv 27 + type t = Id.any 28 + 29 + type t_pv = Id.any_pv 28 30 29 31 let rec name_aux : t -> string = 30 32 fun x -> ··· 52 54 53 55 let name : [< t_pv ] id -> string = fun n -> name_aux (n :> t) 54 56 55 - let rec root id = 56 - match id.iv with 57 - | `Root _ as root -> Some { id with iv = root } 58 - | `Module (parent, _) -> root (parent :> t) 59 - | `Parameter (parent, _) -> root (parent :> t) 60 - | `Result x -> root (x :> t) 61 - | `ModuleType (parent, _) -> root (parent :> t) 62 - | `Type (parent, _) -> root (parent :> t) 63 - | `Constructor (parent, _) -> root (parent :> t) 64 - | `Field (parent, _) -> root (parent :> t) 65 - | `Extension (parent, _) -> root (parent :> t) 66 - | `Exception (parent, _) -> root (parent :> t) 67 - | `Value (parent, _) -> root (parent :> t) 68 - | `Class (parent, _) -> root (parent :> t) 69 - | `ClassType (parent, _) -> root (parent :> t) 70 - | `Method (parent, _) -> root (parent :> t) 71 - | `InstanceVariable (parent, _) -> root (parent :> t) 72 - | `Label (parent, _) -> root (parent :> t) 73 - | `Page _ | `LeafPage _ | `CoreType _ | `CoreException _ -> None 74 - 75 - let root id = root (id :> t) 76 - 77 57 let rec label_parent_aux = 78 - let open Paths_types.Identifier in 79 - fun (n : any) -> 58 + let open Id in 59 + fun (n : t) -> 80 60 match n with 81 61 | { iv = `Result i; _ } -> label_parent_aux (i :> any) 82 62 | { iv = `CoreType _; _ } | { iv = `CoreException _; _ } -> assert false ··· 109 89 110 90 type any = t 111 91 92 + type any_pv = t_pv 93 + 94 + module type IdSig = sig 95 + type t 96 + type t_pv 97 + val equal : t -> t -> bool 98 + val hash : t -> int 99 + val compare : t -> t -> int 100 + end 101 + 112 102 module Any = struct 113 103 type t = any 114 - 104 + type t_pv = any_pv 115 105 let equal = equal 116 - 117 106 let hash = hash 118 - 119 107 let compare = compare 120 108 end 121 109 122 110 module Signature = struct 123 - type t = Paths_types.Identifier.signature 124 - 125 - type t_pv = Paths_types.Identifier.signature_pv 126 - 111 + type t = Id.signature 112 + type t_pv = Id.signature_pv 127 113 let equal = equal 128 - 129 114 let hash = hash 130 - 131 115 let compare = compare 132 - 133 - let rec root = function 134 - | { iv = `Root _; _ } as root -> root 135 - | { 136 - iv = 137 - ( `ModuleType (parent, _) 138 - | `Module (parent, _) 139 - | `Parameter (parent, _) ); 140 - _; 141 - } -> 142 - root parent 143 - | { iv = `Result x; _ } -> root x 144 - 145 - let root id = root (id :> t) 146 116 end 147 117 148 118 module ClassSignature = struct 149 - type t = Paths_types.Identifier.class_signature 150 - 151 - type t_pv = Paths_types.Identifier.class_signature_pv 152 - 119 + type t = Id.class_signature 120 + type t_pv = Id.class_signature_pv 153 121 let equal = equal 154 - 155 122 let hash = hash 156 - 157 123 let compare = compare 158 124 end 159 125 160 126 module DataType = struct 161 - type t = Paths_types.Identifier.datatype 162 - 163 - type t_pv = Paths_types.Identifier.datatype_pv 164 - 165 - let equal = equal 166 - 167 - let hash = hash 168 - 169 - let compare = compare 127 + type t = Id.datatype 128 + type t_pv = Id.datatype_pv 170 129 end 171 130 172 131 module Parent = struct 173 - type t = Paths_types.Identifier.parent 174 - 175 - type t_pv = Paths_types.Identifier.parent_pv 176 - 177 - let equal = equal 178 - 179 - let hash = hash 180 - 181 - let compare = compare 132 + type t = Id.parent 133 + type t_pv = Id.parent_pv 182 134 end 183 135 184 136 module LabelParent = struct 185 - type t = Paths_types.Identifier.label_parent 186 - 187 - type t_pv = Paths_types.Identifier.label_parent_pv 188 - 137 + type t = Id.label_parent 138 + type t_pv = Id.label_parent_pv 189 139 let equal = equal 190 - 191 140 let hash = hash 192 - 193 141 let compare = compare 194 142 end 195 143 196 144 module RootModule = struct 197 - type t = Paths_types.Identifier.root_module 198 - 199 - type t_pv = Paths_types.Identifier.root_module_pv 200 - 145 + type t = Id.root_module 146 + type t_pv = Id.root_module_pv 201 147 let equal = equal 202 - 203 148 let hash = hash 204 - 205 149 let compare = compare 206 - 207 - let name { iv = `Root (_, name); _ } = ModuleName.to_string name 208 150 end 209 151 210 152 module Module = struct 211 - type t = Paths_types.Identifier.module_ 212 - 213 - type t_pv = Paths_types.Identifier.module_pv 214 - 153 + type t = Id.module_ 154 + type t_pv = Id.module_pv 215 155 let equal = equal 216 - 217 156 let hash = hash 218 - 219 157 let compare = compare 220 - 221 - let root id = Signature.root (id :> Signature.t) 222 158 end 223 159 224 160 module FunctorParameter = struct 225 - type t = Paths_types.Identifier.functor_parameter 226 - 227 - type t_pv = Paths_types.Identifier.functor_parameter_pv 228 - 161 + type t = Id.functor_parameter 162 + type t_pv = Id.functor_parameter_pv 229 163 let equal = equal 230 - 231 164 let hash = hash 232 - 233 165 let compare = compare 234 166 end 235 167 236 168 module FunctorResult = struct 237 - type t = Paths_types.Identifier.functor_result 238 - 239 - type t_pv = Paths_types.Identifier.functor_result_pv 240 - 241 - let equal = equal 242 - 243 - let hash = hash 244 - 245 - let compare = compare 169 + type t = Id.functor_result 170 + type t_pv = Id.functor_result_pv 246 171 end 247 172 248 173 module ModuleType = struct 249 - type t = Paths_types.Identifier.module_type 250 - 251 - type t_pv = Paths_types.Identifier.module_type_pv 252 - 174 + type t = Id.module_type 175 + type t_pv = Id.module_type_pv 253 176 let equal = equal 254 - 255 177 let hash = hash 256 - 257 178 let compare = compare 258 179 end 259 180 260 181 module Type = struct 261 - type t = Paths_types.Identifier.type_ 262 - 263 - type t_pv = Paths_types.Identifier.type_pv 264 - 182 + type t = Id.type_ 183 + type t_pv = Id.type_pv 265 184 let equal = equal 266 - 267 185 let hash = hash 268 - 269 186 let compare = compare 270 187 end 271 188 272 189 module Constructor = struct 273 - type t = Paths_types.Identifier.constructor 274 - 275 - type t_pv = Paths_types.Identifier.constructor_pv 276 - 277 - let equal = equal 278 - 279 - let hash = hash 280 - 281 - let compare = compare 190 + type t = Id.constructor 191 + type t_pv = Id.constructor_pv 282 192 end 283 193 284 194 module Field = struct 285 - type t = Paths_types.Identifier.field 286 - 287 - type t_pv = Paths_types.Identifier.field_pv 288 - 289 - let equal = equal 290 - 291 - let hash = hash 292 - 293 - let compare = compare 195 + type t = Id.field 196 + type t_pv = Id.field_pv 294 197 end 295 198 296 199 module Extension = struct 297 - type t = Paths_types.Identifier.extension 298 - 299 - type t_pv = Paths_types.Identifier.extension_pv 300 - 301 - let equal = equal 302 - 303 - let hash = hash 304 - 305 - let compare = compare 200 + type t = Id.extension 201 + type t_pv = Id.extension_pv 306 202 end 307 203 308 204 module Exception = struct 309 - type t = Paths_types.Identifier.exception_ 310 - 311 - type t_pv = Paths_types.Identifier.exception_pv 312 - 313 - let equal = equal 314 - 315 - let hash = hash 316 - 317 - let compare = compare 205 + type t = Id.exception_ 206 + type t_pv = Id.exception_pv 318 207 end 319 208 320 209 module Value = struct 321 - type t = Paths_types.Identifier.value 322 - 323 - type t_pv = Paths_types.Identifier.value_pv 324 - 325 - let equal = equal 326 - 327 - let hash = hash 328 - 329 - let compare = compare 210 + type t = Id.value 211 + type t_pv = Id.value_pv 330 212 end 331 213 332 214 module Class = struct 333 - type t = Paths_types.Identifier.class_ 334 - 335 - type t_pv = Paths_types.Identifier.class_pv 336 - 215 + type t = Id.class_ 216 + type t_pv = Id.class_pv 337 217 let equal = equal 338 - 339 218 let hash = hash 340 - 341 219 let compare = compare 342 220 end 343 221 344 222 module ClassType = struct 345 - type t = Paths_types.Identifier.class_type 346 - 347 - type t_pv = Paths_types.Identifier.class_type_pv 348 - 223 + type t = Id.class_type 224 + type t_pv = Id.class_type_pv 349 225 let equal = equal 350 - 351 226 let hash = hash 352 - 353 227 let compare = compare 354 228 end 355 229 356 230 module Method = struct 357 - type t = Paths_types.Identifier.method_ 358 - 359 - type t_pv = Paths_types.Identifier.method_pv 360 - 361 - let equal = equal 362 - 363 - let hash = hash 364 - 365 - let compare = compare 231 + type t = Id.method_ 232 + type t_pv = Id.method_pv 366 233 end 367 234 368 235 module InstanceVariable = struct 369 - type t = Paths_types.Identifier.instance_variable 370 - 371 - type t_pv = Paths_types.Identifier.instance_variable_pv 372 - 373 - let equal = equal 374 - 375 - let hash = hash 376 - 377 - let compare = compare 236 + type t = Id.instance_variable 237 + type t_pv = Id.instance_variable_pv 378 238 end 379 239 380 240 module Label = struct 381 241 type t = Paths_types.Identifier.label 382 - 383 242 type t_pv = Paths_types.Identifier.label_pv 384 - 385 243 let equal = equal 386 - 387 244 let hash = hash 388 - 389 245 let compare = compare 390 246 end 391 247 392 248 module Page = struct 393 - type t = Paths_types.Identifier.page 394 - 395 - type t_pv = Paths_types.Identifier.page_pv 396 - 397 - let equal = equal 398 - 399 - let hash = hash 400 - 401 - let compare = compare 249 + type t = Id.page 250 + type t_pv = Id.page_pv 402 251 end 403 252 404 253 module ContainerPage = struct 405 - type t = Paths_types.Identifier.container_page 406 - 407 - type t_pv = Paths_types.Identifier.container_page_pv 408 - 409 - let equal = equal 410 - 411 - let hash = hash 412 - 413 - let compare = compare 254 + type t = Id.container_page 255 + type t_pv = Id.container_page_pv 414 256 end 415 257 416 258 module SourceDir = struct 417 - type t = Paths_types.Identifier.source_dir 418 - type t_pv = Paths_types.Identifier.source_dir_pv 259 + type t = Id.source_dir 260 + type t_pv = Id.source_dir_pv 419 261 let equal = equal 420 262 let hash = hash 421 263 let compare = compare ··· 425 267 end 426 268 427 269 module SourcePage = struct 428 - type t = Paths_types.Identifier.source_page 429 - type t_pv = Paths_types.Identifier.source_page_pv 270 + type t = Id.source_page 271 + type t_pv = Id.source_page_pv 430 272 let equal = equal 431 - let hash = hash 432 - let compare = compare 433 273 let name { iv = `SourcePage (p, name); _ } = SourceDir.name p ^ name 274 + 434 275 end 435 276 436 277 module OdocId = struct 437 - type t = Paths_types.Identifier.odoc_id 438 - 439 - type t_pv = Paths_types.Identifier.odoc_id_pv 440 - 441 - let equal = equal 442 - 443 - let hash = hash 444 - 445 - let compare = compare 278 + type t = Id.odoc_id 279 + type t_pv = Id.odoc_id_pv 446 280 end 447 281 448 282 module Path = struct 449 283 module Module = struct 450 - type t = Paths_types.Identifier.path_module 451 - 452 - type t_pv = Paths_types.Identifier.path_module_pv 453 - 284 + type t = Id.path_module 285 + type t_pv = Id.path_module_pv 454 286 let equal = equal 455 - 456 287 let hash = hash 457 - 458 288 let compare = compare 459 - 460 - let root id = Signature.root (id :> Signature.t) 461 289 end 462 290 463 291 module ModuleType = struct 464 - type t = Paths_types.Identifier.path_module_type 465 - 292 + type t = Id.path_module_type 293 + type t_pv = Id.module_type_pv 466 294 let equal = equal 467 - 468 295 let hash = hash 469 - 470 296 let compare = compare 471 297 end 472 298 473 299 module Type = struct 474 - type t = Paths_types.Identifier.path_type 475 - 476 - type t_pv = Paths_types.Identifier.path_type_pv 477 - 300 + type t = Id.path_type 301 + type t_pv = Id.path_type_pv 478 302 let equal = equal 479 - 480 303 let hash = hash 481 - 482 304 let compare = compare 483 305 end 484 306 485 307 module ClassType = struct 486 - type t = Paths_types.Identifier.path_class_type 487 - 488 - type t_pv = Paths_types.Identifier.path_class_type_pv 489 - 308 + type t = Id.path_class_type 309 + type t_pv = Id.path_class_type_pv 490 310 let equal = equal 491 - 492 311 let hash = hash 493 - 494 312 let compare = compare 495 313 end 496 314 497 - type t = Paths_types.Identifier.path_any 315 + type t = Id.path_any 498 316 end 499 317 500 318 module Maps = struct ··· 774 592 775 593 let is_hidden m = 776 594 is_resolved_hidden (m : t :> Paths_types.Resolved_path.any) 777 - 778 - let rec identifier : t -> Identifier.Path.Module.t = 779 - fun x -> 780 - let r = identifier in 781 - match x with 782 - | `Identifier id -> id 783 - | `Subst (_, x) -> r x 784 - | `Hidden p -> r p 785 - | `Module (m, n) -> Identifier.Mk.module_ (parent_module_identifier m, n) 786 - | `Canonical (p, _) -> r p 787 - | `Apply (m, _) -> r m 788 - | `Alias (dest, _src) -> r dest 789 - | `OpaqueModule m -> r m 790 - 791 - let rec root : t -> string option = function 792 - | `Identifier id -> ( 793 - match Identifier.root (id :> Identifier.t) with 794 - | Some root -> Some (Identifier.name root) 795 - | None -> None) 796 - | `Subst (_, p) 797 - | `Hidden p 798 - | `Module (p, _) 799 - | `Canonical (p, _) 800 - | `Apply (p, _) 801 - | `Alias (p, _) 802 - | `OpaqueModule p -> 803 - root p 804 595 end 805 596 806 597 module ModuleType = struct 807 598 type t = Paths_types.Resolved_path.module_type 808 - 809 - let is_hidden m = 810 - is_resolved_hidden (m : t :> Paths_types.Resolved_path.any) 811 599 end 812 600 813 601 module Type = struct 814 602 type t = Paths_types.Resolved_path.type_ 815 - 816 - let of_ident id = `Identifier id 817 - 818 - let is_hidden m = 819 - is_resolved_hidden ~weak_canonical_test:false 820 - (m : t :> Paths_types.Resolved_path.any) 821 603 end 822 604 823 605 module ClassType = struct 824 606 type t = Paths_types.Resolved_path.class_type 825 - 826 - let of_ident id = `Identifier id 827 - 828 - let is_hidden m = 829 - is_resolved_hidden ~weak_canonical_test:false 830 - (m : t :> Paths_types.Resolved_path.any) 831 607 end 832 608 833 609 let rec identifier : t -> Identifier.t = function ··· 866 642 867 643 module Module = struct 868 644 type t = Paths_types.Path.module_ 869 - 870 - let rec root : t -> string option = function 871 - | `Resolved r -> Resolved.Module.root r 872 - | `Identifier (id, _) -> ( 873 - match Identifier.root (id :> Identifier.t) with 874 - | Some root -> Some (Identifier.name root) 875 - | None -> None) 876 - | `Root s -> Some s 877 - | `Forward _ -> None 878 - | `Dot (p, _) | `Apply (p, _) -> root p 879 645 end 880 646 881 647 module ModuleType = struct ··· 899 665 900 666 type root = Paths_types.Resolved_fragment.root 901 667 902 - let sig_of_mod m = 903 - let open Paths_types.Resolved_fragment in 904 - (m : module_ :> signature) 905 - 906 - type base_name = 907 - | Base of root 908 - | Branch of ModuleName.t * Paths_types.Resolved_fragment.signature 909 - 910 - let rec split_parent : Paths_types.Resolved_fragment.signature -> base_name 911 - = function 912 - | `Root i -> Base i 913 - | `Subst (_, p) -> split_parent (sig_of_mod p) 914 - | `Alias (_, p) -> split_parent (sig_of_mod p) 915 - | `OpaqueModule m -> split_parent (sig_of_mod m) 916 - | `Module (p, name) -> ( 917 - match split_parent p with 918 - | Base i -> Branch (name, `Root i) 919 - | Branch (base, m) -> Branch (base, `Module (m, name))) 920 - 921 668 module Signature = struct 922 669 type t = Paths_types.Resolved_fragment.signature 923 670 924 - let rec split : t -> string * t option = function 925 - | `Root _ -> ("", None) 926 - | `Subst (_, p) -> split (sig_of_mod p) 927 - | `Alias (_, p) -> split (sig_of_mod p) 928 - | `OpaqueModule m -> split (sig_of_mod m) 929 - | `Module (m, name) -> ( 930 - match split_parent m with 931 - | Base _ -> (ModuleName.to_string name, None) 932 - | Branch (base, m) -> 933 - (ModuleName.to_string base, Some (`Module (m, name)))) 934 - 935 - let rec identifier : t -> Identifier.Signature.t = function 671 + let rec sgidentifier : t -> Identifier.Signature.t = function 936 672 | `Root (`ModuleType i) -> Path.Resolved.parent_module_type_identifier i 937 673 | `Root (`Module i) -> Path.Resolved.parent_module_identifier i 938 674 | `Subst (s, _) -> Path.Resolved.parent_module_type_identifier s 939 675 | `Alias (i, _) -> Path.Resolved.parent_module_identifier i 940 - | `Module (m, n) -> Identifier.Mk.module_ (identifier m, n) 941 - | `OpaqueModule m -> identifier (sig_of_mod m) 676 + | `Module (m, n) -> Identifier.Mk.module_ (sgidentifier m, n) 677 + | `OpaqueModule m -> sgidentifier (m :> t) 942 678 end 943 679 944 680 module Module = struct 945 681 type t = Paths_types.Resolved_fragment.module_ 946 - 947 - let rec split : t -> string * t option = function 948 - | `Subst (_, p) -> split p 949 - | `Alias (_, p) -> split p 950 - | `Module (m, name) -> ( 951 - match split_parent m with 952 - | Base _ -> (ModuleName.to_string name, None) 953 - | Branch (base, m) -> 954 - (ModuleName.to_string base, Some (`Module (m, name)))) 955 - | `OpaqueModule m -> split m 956 682 end 957 683 958 684 module ModuleType = struct 959 685 type t = Paths_types.Resolved_fragment.module_type 960 - 961 - let split : t -> string * t option = function 962 - | `Module_type (m, name) -> ( 963 - match split_parent m with 964 - | Base _ -> (ModuleTypeName.to_string name, None) 965 - | Branch (base, m) -> 966 - (ModuleName.to_string base, Some (`Module_type (m, name)))) 967 686 end 968 687 969 688 module Type = struct 970 689 type t = Paths_types.Resolved_fragment.type_ 971 - 972 - let split : t -> string * t option = function 973 - | `Type (m, name) -> ( 974 - match split_parent m with 975 - | Base _ -> (TypeName.to_string name, None) 976 - | Branch (base, m) -> 977 - (ModuleName.to_string base, Some (`Type (m, name)))) 978 - | `Class (m, name) -> ( 979 - match split_parent m with 980 - | Base _ -> (ClassName.to_string name, None) 981 - | Branch (base, m) -> 982 - (ModuleName.to_string base, Some (`Class (m, name)))) 983 - | `ClassType (m, name) -> ( 984 - match split_parent m with 985 - | Base _ -> (ClassTypeName.to_string name, None) 986 - | Branch (base, m) -> 987 - (ModuleName.to_string base, Some (`ClassType (m, name)))) 988 690 end 989 691 990 692 type leaf = Paths_types.Resolved_fragment.leaf ··· 995 697 | `Subst (s, _) -> Path.Resolved.identifier (s :> Path.Resolved.t) 996 698 | `Alias (p, _) -> 997 699 (Path.Resolved.parent_module_identifier p :> Identifier.t) 998 - | `Module (m, n) -> Identifier.Mk.module_ (Signature.identifier m, n) 700 + | `Module (m, n) -> Identifier.Mk.module_ (Signature.sgidentifier m, n) 999 701 | `Module_type (m, n) -> 1000 - Identifier.Mk.module_type (Signature.identifier m, n) 1001 - | `Type (m, n) -> Identifier.Mk.type_ (Signature.identifier m, n) 1002 - | `Class (m, n) -> Identifier.Mk.class_ (Signature.identifier m, n) 1003 - | `ClassType (m, n) -> Identifier.Mk.class_type (Signature.identifier m, n) 702 + Identifier.Mk.module_type (Signature.sgidentifier m, n) 703 + | `Type (m, n) -> Identifier.Mk.type_ (Signature.sgidentifier m, n) 704 + | `Class (m, n) -> Identifier.Mk.class_ (Signature.sgidentifier m, n) 705 + | `ClassType (m, n) -> 706 + Identifier.Mk.class_type (Signature.sgidentifier m, n) 1004 707 | `OpaqueModule m -> identifier (m :> t) 1005 708 1006 709 let rec is_hidden : t -> bool = function 1007 - | `Root (`ModuleType r) -> 1008 - Path.is_resolved_hidden ~weak_canonical_test:false 1009 - (r :> Path.Resolved.t) 1010 - | `Root (`Module r) -> 1011 - Path.is_resolved_hidden ~weak_canonical_test:false 1012 - (r :> Path.Resolved.t) 1013 - | `Subst (s, _) -> 1014 - Path.is_resolved_hidden ~weak_canonical_test:false 1015 - (s :> Path.Resolved.t) 1016 - | `Alias (s, _) -> 1017 - Path.is_resolved_hidden ~weak_canonical_test:false 1018 - (s :> Path.Resolved.t) 710 + | `Root (`ModuleType r) -> Path.Resolved.(is_hidden (r :> t)) 711 + | `Root (`Module r) -> Path.Resolved.(is_hidden (r :> t)) 712 + | `Subst (s, _) -> Path.Resolved.(is_hidden (s :> t)) 713 + | `Alias (s, _) -> Path.Resolved.(is_hidden (s :> t)) 1019 714 | `Module (m, _) 1020 715 | `Module_type (m, _) 1021 716 | `Type (m, _) ··· 1026 721 end 1027 722 1028 723 type t = Paths_types.Fragment.any 1029 - 1030 - type base_name = 1031 - | Base of Resolved.root option 1032 - | Branch of ModuleName.t * Paths_types.Fragment.signature 1033 - 1034 - let rec split_parent : Paths_types.Fragment.signature -> base_name = function 1035 - | `Root -> Base None 1036 - | `Resolved r -> ( 1037 - match Resolved.split_parent r with 1038 - | Resolved.Base i -> Base (Some i) 1039 - | Resolved.Branch (base, m) -> Branch (base, `Resolved m)) 1040 - | `Dot (m, name) -> ( 1041 - match split_parent m with 1042 - | Base None -> Branch (ModuleName.make_std name, `Root) 1043 - | Base (Some i) -> Branch (ModuleName.make_std name, `Resolved (`Root i)) 1044 - | Branch (base, m) -> Branch (base, `Dot (m, name))) 1045 724 1046 725 module Signature = struct 1047 726 type t = Paths_types.Fragment.signature 1048 - 1049 - let split : t -> string * t option = function 1050 - | `Root -> ("", None) 1051 - | `Resolved r -> 1052 - let base, m = Resolved.Signature.split r in 1053 - let m = match m with None -> None | Some m -> Some (`Resolved m) in 1054 - (base, m) 1055 - | `Dot (m, name) -> ( 1056 - match split_parent m with 1057 - | Base _ -> (name, None) 1058 - | Branch (base, m) -> 1059 - (ModuleName.to_string base, Some (`Dot (m, name)))) 1060 727 end 1061 728 1062 729 module Module = struct 1063 730 type t = Paths_types.Fragment.module_ 1064 - 1065 - let split : t -> string * t option = function 1066 - | `Resolved r -> 1067 - let base, m = Resolved.Module.split r in 1068 - let m = match m with None -> None | Some m -> Some (`Resolved m) in 1069 - (base, m) 1070 - | `Dot (m, name) -> ( 1071 - match split_parent m with 1072 - | Base _ -> (name, None) 1073 - | Branch (base, m) -> 1074 - (ModuleName.to_string base, Some (`Dot (m, name)))) 1075 731 end 1076 732 1077 733 module ModuleType = struct 1078 734 type t = Paths_types.Fragment.module_type 1079 - 1080 - let split : t -> string * t option = function 1081 - | `Resolved r -> 1082 - let base, m = Resolved.ModuleType.split r in 1083 - let m = match m with None -> None | Some m -> Some (`Resolved m) in 1084 - (base, m) 1085 - | `Dot (m, name) -> ( 1086 - match split_parent m with 1087 - | Base _ -> (name, None) 1088 - | Branch (base, m) -> 1089 - (ModuleName.to_string base, Some (`Dot (m, name)))) 1090 735 end 1091 736 1092 737 module Type = struct 1093 738 type t = Paths_types.Fragment.type_ 1094 - 1095 - let split : t -> string * t option = function 1096 - | `Resolved r -> 1097 - let base, m = Resolved.Type.split r in 1098 - let m = match m with None -> None | Some m -> Some (`Resolved m) in 1099 - (base, m) 1100 - | `Dot (m, name) -> ( 1101 - match split_parent m with 1102 - | Base _ -> (name, None) 1103 - | Branch (base, m) -> 1104 - (ModuleName.to_string base, Some (`Dot (m, name)))) 1105 739 end 1106 740 1107 741 type leaf = Paths_types.Fragment.leaf ··· 1118 752 | `Identifier id -> id 1119 753 | `Hidden s -> parent_signature_identifier (s :> signature) 1120 754 | `Alias (sub, orig) -> 1121 - if Path.Resolved.Module.is_hidden ~weak_canonical_test:false sub then 755 + if Path.Resolved.(is_hidden (sub :> t)) then 1122 756 parent_signature_identifier (orig :> signature) 1123 757 else 1124 758 (Path.Resolved.parent_module_identifier sub 1125 759 :> Identifier.Signature.t) 1126 760 | `AliasModuleType (sub, orig) -> 1127 - if Path.Resolved.ModuleType.is_hidden ~weak_canonical_test:false sub 1128 - then parent_signature_identifier (orig :> signature) 761 + if Path.Resolved.(is_hidden (sub :> t)) then 762 + parent_signature_identifier (orig :> signature) 1129 763 else 1130 764 (Path.Resolved.parent_module_type_identifier sub 1131 765 :> Identifier.Signature.t)
+82 -333
src/model/paths.mli
··· 24 24 25 25 type 'a id = 'a Paths_types.id = { iv : 'a; ihash : int; ikey : string } 26 26 27 - module Any : sig 28 - type t = Paths_types.Identifier.any 29 - 27 + module type IdSig = sig 28 + type t 29 + type t_pv 30 30 val equal : t -> t -> bool 31 - 32 31 val hash : t -> int 33 - 34 32 val compare : t -> t -> int 35 33 end 36 34 37 - module RootModule : sig 38 - type t = Paths_types.Identifier.root_module 35 + module Id = Paths_types.Identifier 39 36 40 - type t_pv = Paths_types.Identifier.root_module_pv 37 + module Any : IdSig with type t = Id.any and type t_pv = Id.any_pv 41 38 42 - val equal : t -> t -> bool 39 + module RootModule : 40 + IdSig with type t = Id.root_module and type t_pv = Id.root_module_pv 43 41 44 - val hash : t -> int 42 + module Signature : 43 + IdSig with type t = Id.signature and type t_pv = Id.signature_pv 45 44 46 - val compare : t -> t -> int 45 + module ClassSignature : 46 + IdSig with type t = Id.class_signature and type t_pv = Id.class_signature_pv 47 47 48 - val name : t -> string 49 - end 48 + module LabelParent : 49 + IdSig with type t = Id.label_parent and type t_pv = Id.label_parent_pv 50 50 51 - module Signature : sig 52 - type t = Paths_types.Identifier.signature 51 + module Module : IdSig with type t = Id.module_ and type t_pv = Id.module_pv 53 52 54 - type t_pv = Paths_types.Identifier.signature_pv 53 + module FunctorParameter : 54 + IdSig 55 + with type t = Id.functor_parameter 56 + and type t_pv = Id.functor_parameter_pv 55 57 56 - val equal : t -> t -> bool 58 + module ModuleType : 59 + IdSig with type t = Id.module_type and type t_pv = Id.module_type_pv 57 60 58 - val hash : t -> int 61 + module Type : IdSig with type t = Id.type_ and type t_pv = Id.type_pv 59 62 60 - val compare : t -> t -> int 63 + module SourceDir : sig 61 64 62 - val root : [< t_pv ] id -> RootModule.t 65 + include IdSig with type t = Id.source_dir and type t_pv = Id.source_dir_pv 66 + val name : t -> string 63 67 end 64 68 65 - module ClassSignature : sig 66 - type t = Paths_types.Identifier.class_signature 67 - 68 - type t_pv = Paths_types.Identifier.class_signature_pv 69 - 70 - val equal : t -> t -> bool 71 - 72 - val hash : t -> int 69 + module Class : IdSig with type t = Id.class_ and type t_pv = Id.class_pv 73 70 74 - val compare : t -> t -> int 75 - end 71 + module ClassType : 72 + IdSig with type t = Id.class_type and type t_pv = Id.class_type_pv 76 73 77 74 module DataType : sig 78 - type t = Paths_types.Identifier.datatype 79 - 80 - type t_pv = Paths_types.Identifier.datatype_pv 81 - 82 - val equal : t -> t -> bool 83 - 84 - val hash : t -> int 85 - 86 - val compare : t -> t -> int 75 + type t = Id.datatype 76 + type t_pv = Id.datatype_pv 87 77 end 88 - 89 78 module Parent : sig 90 - type t = Paths_types.Identifier.parent 91 - 92 - type t_pv = Paths_types.Identifier.parent_pv 93 - 94 - val equal : t -> t -> bool 95 - 96 - val hash : t -> int 97 - 98 - val compare : t -> t -> int 99 - end 100 - 101 - module LabelParent : sig 102 - type t = Paths_types.Identifier.label_parent 103 - 104 - type t_pv = Paths_types.Identifier.label_parent_pv 105 - 106 - val equal : t -> t -> bool 107 - 108 - val hash : t -> int 109 - 110 - val compare : t -> t -> int 111 - end 112 - 113 - module Module : sig 114 - type t = Paths_types.Identifier.module_ 115 - 116 - type t_pv = Paths_types.Identifier.module_pv 117 - 118 - val equal : t -> t -> bool 119 - 120 - val hash : t -> int 121 - 122 - val compare : t -> t -> int 123 - 124 - val root : t -> RootModule.t 125 - end 126 - 127 - module FunctorParameter : sig 128 - type t = Paths_types.Identifier.functor_parameter 129 - 130 - type t_pv = Paths_types.Identifier.functor_parameter_pv 131 - 132 - val equal : t -> t -> bool 133 - 134 - val hash : t -> int 135 - 136 - val compare : t -> t -> int 79 + type t = Id.parent 80 + type t_pv = Id.parent_pv 137 81 end 138 82 139 83 module FunctorResult : sig 140 - type t = Paths_types.Identifier.functor_result 141 - 142 - type t_pv = Paths_types.Identifier.functor_result_pv 143 - 144 - val equal : t -> t -> bool 145 - 146 - val hash : t -> int 147 - 148 - val compare : t -> t -> int 149 - end 150 - 151 - module ModuleType : sig 152 - type t = Paths_types.Identifier.module_type 153 - 154 - type t_pv = Paths_types.Identifier.module_type_pv 155 - 156 - val equal : t -> t -> bool 157 - 158 - val hash : t -> int 159 - 160 - val compare : t -> t -> int 161 - end 162 - 163 - module Type : sig 164 - type t = Paths_types.Identifier.type_ 165 - 166 - type t_pv = Paths_types.Identifier.type_pv 167 - 168 - val equal : t -> t -> bool 169 - 170 - val hash : t -> int 171 - 172 - val compare : t -> t -> int 84 + type t = Id.functor_result 85 + type t_pv = Id.functor_result_pv 173 86 end 174 87 175 88 module Constructor : sig 176 - type t = Paths_types.Identifier.constructor 177 - 178 - type t_pv = Paths_types.Identifier.constructor_pv 179 - 180 - val equal : t -> t -> bool 181 - 182 - val hash : t -> int 183 - 184 - val compare : t -> t -> int 89 + type t = Id.constructor 90 + type t_pv = Id.constructor_pv 185 91 end 186 92 187 93 module Field : sig 188 - type t = Paths_types.Identifier.field 189 - 190 - type t_pv = Paths_types.Identifier.field_pv 191 - 192 - val equal : t -> t -> bool 193 - 194 - val hash : t -> int 195 - 196 - val compare : t -> t -> int 94 + type t = Id.field 95 + type t_pv = Id.field_pv 197 96 end 198 97 199 98 module Extension : sig 200 - type t = Paths_types.Identifier.extension 201 - 202 - type t_pv = Paths_types.Identifier.extension_pv 203 - 204 - val equal : t -> t -> bool 205 - 206 - val hash : t -> int 207 - 208 - val compare : t -> t -> int 99 + type t = Id.extension 100 + type t_pv = Id.extension_pv 209 101 end 210 102 211 103 module Exception : sig 212 - type t = Paths_types.Identifier.exception_ 213 - 214 - type t_pv = Paths_types.Identifier.exception_pv 215 - 216 - val equal : t -> t -> bool 217 - 218 - val hash : t -> int 219 - 220 - val compare : t -> t -> int 104 + type t = Id.exception_ 105 + type t_pv = Id.exception_pv 221 106 end 222 107 223 108 module Value : sig 224 - type t = Paths_types.Identifier.value 225 - 226 - type t_pv = Paths_types.Identifier.value_pv 227 - 228 - val equal : t -> t -> bool 229 - 230 - val hash : t -> int 231 - 232 - val compare : t -> t -> int 233 - end 234 - 235 - module Class : sig 236 - type t = Paths_types.Identifier.class_ 237 - 238 - type t_pv = Paths_types.Identifier.class_pv 239 - 240 - val equal : t -> t -> bool 241 - 242 - val hash : t -> int 243 - 244 - val compare : t -> t -> int 245 - end 246 - 247 - module ClassType : sig 248 - type t = Paths_types.Identifier.class_type 249 - 250 - type t_pv = Paths_types.Identifier.class_type_pv 251 - 252 - val equal : t -> t -> bool 253 - 254 - val hash : t -> int 255 - 256 - val compare : t -> t -> int 109 + type t = Id.value 110 + type t_pv = Id.value_pv 257 111 end 258 112 259 113 module Method : sig 260 - type t = Paths_types.Identifier.method_ 261 - 262 - type t_pv = Paths_types.Identifier.method_pv 263 - 264 - val equal : t -> t -> bool 265 - 266 - val hash : t -> int 267 - 268 - val compare : t -> t -> int 114 + type t = Id.method_ 115 + type t_pv = Id.method_pv 269 116 end 270 117 271 118 module InstanceVariable : sig 272 - type t = Paths_types.Identifier.instance_variable 273 - 274 - type t_pv = Paths_types.Identifier.instance_variable_pv 275 - 276 - val equal : t -> t -> bool 277 - 278 - val hash : t -> int 279 - 280 - val compare : t -> t -> int 281 - end 282 - 283 - module Label : sig 284 - type t = Paths_types.Identifier.label 285 - 286 - type t_pv = Paths_types.Identifier.label_pv 287 - 288 - val equal : t -> t -> bool 289 - 290 - val hash : t -> int 291 - 292 - val compare : t -> t -> int 119 + type t = Id.instance_variable 120 + type t_pv = Id.instance_variable_pv 293 121 end 122 + module Label : 123 + IdSig 124 + with type t = Paths_types.Identifier.label 125 + and type t_pv = Paths_types.Identifier.label_pv 294 126 295 127 module Page : sig 296 - type t = Paths_types.Identifier.page 297 - 298 - type t_pv = Paths_types.Identifier.page_pv 299 - 300 - val equal : t -> t -> bool 301 - 302 - val hash : t -> int 303 - 304 - val compare : t -> t -> int 128 + type t = Id.page 129 + type t_pv = Id.page_pv 305 130 end 306 131 307 132 module ContainerPage : sig 308 - type t = Paths_types.Identifier.container_page 309 - 310 - type t_pv = Paths_types.Identifier.container_page_pv 311 - 312 - val equal : t -> t -> bool 313 - 314 - val hash : t -> int 315 - 316 - val compare : t -> t -> int 317 - end 318 - 319 - module SourceDir : sig 320 - type t = Paths_types.Identifier.source_dir 321 - type t_pv = Paths_types.Identifier.source_dir_pv 322 - val equal : t -> t -> bool 323 - val hash : t -> int 324 - val compare : t -> t -> int 325 - val name : t -> string 133 + type t = Id.container_page 134 + type t_pv = Id.container_page_pv 326 135 end 327 136 328 137 module SourcePage : sig 329 - type t = Paths_types.Identifier.source_page 330 - type t_pv = Paths_types.Identifier.source_page_pv 138 + type t = Id.source_page 139 + type t_pv = Id.source_page_pv 140 + val name : t -> string 331 141 val equal : t -> t -> bool 332 - val hash : t -> int 333 - val compare : t -> t -> int 334 - val name : t -> string 335 142 end 336 - 337 143 module OdocId : sig 338 - type t = Paths_types.Identifier.odoc_id 339 - 340 - type t_pv = Paths_types.Identifier.odoc_id_pv 341 - 342 - val equal : t -> t -> bool 343 - 344 - val hash : t -> int 345 - 346 - val compare : t -> t -> int 144 + type t = Id.odoc_id 145 + type t_pv = Id.odoc_id_pv 347 146 end 348 147 349 148 module Path : sig 350 - module Module : sig 351 - type t = Paths_types.Identifier.path_module 352 - 353 - type t_pv = Paths_types.Identifier.path_module_pv 354 - 355 - val equal : t -> t -> bool 356 - 357 - val hash : t -> int 358 - 359 - val compare : t -> t -> int 360 - 361 - val root : t -> RootModule.t 362 - end 363 - 364 - module ModuleType : sig 365 - type t = Paths_types.Identifier.path_module_type 366 - 367 - val equal : t -> t -> bool 368 - 369 - val hash : t -> int 370 - 371 - val compare : t -> t -> int 372 - end 373 - 374 - module Type : sig 375 - type t = Paths_types.Identifier.path_type 376 - 377 - type t_pv = Paths_types.Identifier.path_type_pv 149 + module Module : 150 + IdSig with type t = Id.path_module and type t_pv = Id.path_module_pv 378 151 379 - val equal : t -> t -> bool 152 + module ModuleType : 153 + IdSig with type t = Id.path_module_type and type t_pv = Id.module_type_pv 380 154 381 - val hash : t -> int 155 + module Type : 156 + IdSig with type t = Id.path_type and type t_pv = Id.path_type_pv 382 157 383 - val compare : t -> t -> int 384 - end 158 + module ClassType : 159 + IdSig 160 + with type t = Id.path_class_type 161 + and type t_pv = Id.path_class_type_pv 385 162 386 - module ClassType : sig 387 - type t = Paths_types.Identifier.path_class_type 388 - 389 - type t_pv = Paths_types.Identifier.path_class_type_pv 390 - 391 - val equal : t -> t -> bool 392 - 393 - val hash : t -> int 394 - 395 - val compare : t -> t -> int 396 - end 397 - 398 - type t = Paths_types.Identifier.path_any 163 + type t = Id.path_any 399 164 end 400 165 401 - type t_pv = Paths_types.Identifier.any_pv 166 + type t = Id.any 402 167 403 - type t = Paths_types.Identifier.any 168 + type t_pv = Id.any_pv 404 169 405 170 val hash : t -> int 406 171 407 172 val name : [< t_pv ] id -> string 408 173 409 - val root : [< t_pv ] id -> RootModule.t_pv id option 174 + (* val root : [< t_pv ] id -> RootModule.t_pv id option *) 410 175 411 176 val compare : t -> t -> int 412 177 ··· 523 288 524 289 val is_hidden : t -> weak_canonical_test:bool -> bool 525 290 526 - val identifier : t -> Identifier.Path.Module.t 291 + (* val identifier : t -> Identifier.Path.Module.t *) 527 292 528 - val root : t -> string option 293 + (* val root : t -> string option *) 529 294 end 530 295 531 296 module ModuleType : sig 532 297 type t = Paths_types.Resolved_path.module_type 533 298 534 - val is_hidden : t -> weak_canonical_test:bool -> bool 299 + (* val is_hidden : t -> weak_canonical_test:bool -> bool *) 535 300 536 301 (* val identifier : t -> Identifier.Path.ModuleType.t *) 537 302 end ··· 539 304 module Type : sig 540 305 type t = Paths_types.Resolved_path.type_ 541 306 542 - val of_ident : Identifier.Path.Type.t -> t 307 + (* val of_ident : Identifier.Path.Type.t -> t *) 543 308 544 - val is_hidden : t -> bool 309 + (* val is_hidden : t -> bool *) 545 310 546 311 (* val identifier : t -> Identifier.Path.Type.t *) 547 312 end ··· 549 314 module ClassType : sig 550 315 type t = Paths_types.Resolved_path.class_type 551 316 552 - val of_ident : Identifier.Path.ClassType.t -> t 317 + (* val of_ident : Identifier.Path.ClassType.t -> t *) 553 318 554 - val is_hidden : t -> bool 319 + (* val is_hidden : t -> bool *) 555 320 end 556 321 557 322 type t = Paths_types.Resolved_path.any ··· 564 329 module Module : sig 565 330 type t = Paths_types.Path.module_ 566 331 567 - val root : t -> string option 332 + (* val root : t -> string option *) 568 333 end 569 334 570 335 module ModuleType : sig ··· 589 354 module Resolved : sig 590 355 module Signature : sig 591 356 type t = Paths_types.Resolved_fragment.signature 592 - 593 - val split : t -> string * t option 594 357 end 595 358 596 359 module Module : sig 597 360 type t = Paths_types.Resolved_fragment.module_ 598 - 599 - val split : t -> string * t option 600 361 end 601 362 602 363 module ModuleType : sig 603 364 type t = Paths_types.Resolved_fragment.module_type 604 - 605 - val split : t -> string * t option 606 365 end 607 366 608 367 module Type : sig 609 368 type t = Paths_types.Resolved_fragment.type_ 610 - 611 - val split : t -> string * t option 612 369 end 613 370 614 371 type leaf = Paths_types.Resolved_fragment.leaf ··· 624 381 625 382 module Signature : sig 626 383 type t = Paths_types.Fragment.signature 627 - 628 - val split : t -> string * t option 629 384 end 630 385 631 386 module Module : sig 632 387 type t = Paths_types.Fragment.module_ 633 - 634 - val split : t -> string * t option 635 388 end 636 389 637 390 module ModuleType : sig 638 391 type t = Paths_types.Fragment.module_type 639 - 640 - val split : t -> string * t option 641 392 end 642 393 643 394 module Type : sig 644 395 type t = Paths_types.Fragment.type_ 645 - 646 - val split : t -> string * t option 647 396 end 648 397 649 398 type leaf = Paths_types.Fragment.leaf
+1 -3
src/odoc/compile.ml
··· 309 309 | { Paths.Identifier.iv = `Page _; _ } as parent_id -> 310 310 let name = Paths.Identifier.Mk.source_page (parent_id, name) in 311 311 if 312 - List.exists 313 - (Paths.Identifier.SourcePage.equal name) 314 - page.source_children 312 + List.exists (Paths.Identifier.SourcePage.equal name) page.source_children 315 313 then Ok (Some name) 316 314 else err_not_parent () 317 315 | { iv = `LeafPage _; _ } -> err_not_parent ())
+3 -5
src/xref2/cpath.ml
··· 219 219 220 220 and is_resolved_module_type_hidden : Resolved.module_type -> bool = function 221 221 | `Local _ -> false 222 - | `Gpath p -> 223 - Odoc_model.Paths.Path.Resolved.ModuleType.is_hidden 224 - ~weak_canonical_test:false p 222 + | `Gpath p -> Odoc_model.Paths.Path.Resolved.(is_hidden (p :> t)) 225 223 | `Substituted p -> is_resolved_module_type_hidden p 226 224 | `ModuleType (p, _) -> is_resolved_parent_hidden ~weak_canonical_test:false p 227 225 | `SubstT (p1, p2) -> ··· 247 245 248 246 and is_resolved_type_hidden : Resolved.type_ -> bool = function 249 247 | `Local _ -> false 250 - | `Gpath p -> Odoc_model.Paths.Path.Resolved.Type.is_hidden p 248 + | `Gpath p -> Odoc_model.Paths.Path.Resolved.(is_hidden (p :> t)) 251 249 | `Substituted p -> is_resolved_type_hidden p 252 250 | `CanonicalType (_, `Resolved _) -> false 253 251 | `CanonicalType (p, _) -> is_resolved_type_hidden p ··· 256 254 257 255 and is_resolved_class_type_hidden : Resolved.class_type -> bool = function 258 256 | `Local _ -> false 259 - | `Gpath p -> Odoc_model.Paths.Path.Resolved.ClassType.is_hidden p 257 + | `Gpath p -> Odoc_model.Paths.Path.Resolved.(is_hidden (p :> t)) 260 258 | `Substituted p -> is_resolved_class_type_hidden p 261 259 | `Class (p, _) | `ClassType (p, _) -> 262 260 is_resolved_parent_hidden ~weak_canonical_test:false p
+1 -1
src/xref2/link.ml
··· 847 847 let hidden_path = 848 848 match equation.Equation.manifest with 849 849 | Some (Constr (`Resolved path, params)) 850 - when Paths.Path.Resolved.Type.is_hidden path 850 + when Paths.Path.Resolved.(is_hidden (path :> t)) 851 851 || Paths.Path.Resolved.(identifier (path :> t)) 852 852 = (t.id :> Paths.Identifier.t) -> 853 853 Some (path, params)