• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ocaml / odoc / 3135

05 May 2026 06:47AM UTC coverage: 71.021% (-0.1%) from 71.162%
3135

Pull #1407

github

web-flow
Merge e33dd8b1b into 5e9c5c031
Pull Request #1407: OxCaml: Support for unboxed named types

1 of 31 new or added lines in 10 files covered. (3.23%)

11 existing lines in 3 files now uncovered.

10411 of 14659 relevant lines covered (71.02%)

5887.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.12
/src/model/paths.ml
1
(*
2
 * Copyright (c) 2014 Leo White <lpw25@cl.cam.ac.uk>
3
 *
4
 * Permission to use, copy, modify, and distribute this software for any
5
 * purpose with or without fee is hereby granted, provided that the above
6
 * copyright notice and this permission notice appear in all copies.
7
 *
8
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
 *)
16

17
module Ocaml_ident = Ident
18
module Ocaml_env = Env
19

20
open Names
21

22
module Identifier = struct
23
  type 'a id = 'a Paths_types.id = { iv : 'a; ihash : int; ikey : string }
24

25
  module Id = Paths_types.Identifier
26

27
  type t = Id.any
28

29
  type t_pv = Id.any_pv
30

31
  let rec name_aux : t -> string =
32
   fun x ->
33
    match x.iv with
174,730✔
34
    | `Root (_, name) -> ModuleName.to_string name
49,052✔
35
    | `Page (_, name) -> PageName.to_string name
31✔
36
    | `LeafPage (_, name) -> PageName.to_string name
63✔
37
    | `Module (_, name) -> ModuleName.to_string name
14,823✔
38
    | `Parameter (_, name) -> ModuleName.to_string name
2,125✔
39
    | `Result x -> name_aux (x :> t)
×
40
    | `ModuleType (_, name) -> ModuleTypeName.to_string name
3,170✔
41
    | `Type (_, name) -> TypeName.to_string name
100,239✔
42
    | `Constructor (_, name) -> ConstructorName.to_string name
954✔
43
    | `Field (_, name) -> FieldName.to_string name
230✔
44
    | `UnboxedField (_, name) -> UnboxedFieldName.to_string name
×
45
    | `Extension (_, name) -> ExtensionName.to_string name
469✔
46
    | `ExtensionDecl (_, _, name) -> ExtensionName.to_string name
2✔
47
    | `Exception (_, name) -> ExceptionName.to_string name
111✔
48
    | `Value (_, name) -> ValueName.to_string name
2,234✔
49
    | `Class (_, name) -> TypeName.to_string name
262✔
50
    | `ClassType (_, name) -> TypeName.to_string name
142✔
51
    | `Method (_, name) -> MethodName.to_string name
90✔
52
    | `InstanceVariable (_, name) -> InstanceVariableName.to_string name
17✔
53
    | `Label (_, name) -> LabelName.to_string name
708✔
54
    | `SourcePage (_, name) -> name
2✔
55
    | `SourceLocation (x, anchor) ->
×
56
        name_aux (x :> t) ^ "#" ^ DefName.to_string anchor
×
57
    | `SourceLocationMod x -> name_aux (x :> t)
×
58
    | `SourceLocationInternal (x, anchor) ->
×
59
        name_aux (x :> t) ^ "#" ^ LocalName.to_string anchor
×
60
    | `AssetFile (_, name) -> AssetName.to_string name
6✔
61

62
  let rec is_hidden : t -> bool =
63
   fun x ->
64
    match x.iv with
330,909✔
65
    | `Root (_, name) -> ModuleName.is_hidden name
50,960✔
66
    | `Page (_, _) -> false
×
67
    | `LeafPage (_, _) -> false
×
68
    | `Module (_, name) -> ModuleName.is_hidden name
36,234✔
69
    | `Parameter (_, name) -> ModuleName.is_hidden name
2,182✔
70
    | `Result x -> is_hidden (x :> t)
67✔
71
    | `ModuleType (_, name) -> ModuleTypeName.is_hidden name
3,541✔
72
    | `Type (_, name) -> TypeName.is_hidden name
121,225✔
73
    | `Constructor (parent, _) -> is_hidden (parent :> t)
239✔
74
    | `Field (parent, _) -> is_hidden (parent :> t)
2✔
75
    | `UnboxedField (parent, _) -> is_hidden (parent :> t)
×
76
    | `Extension (parent, _) -> is_hidden (parent :> t)
34✔
77
    | `ExtensionDecl (parent, _, _) -> is_hidden (parent :> t)
×
78
    | `Exception (parent, _) -> is_hidden (parent :> t)
35✔
79
    | `Value (_, name) -> ValueName.is_hidden name
116,257✔
80
    | `Class (_, name) -> TypeName.is_hidden name
77✔
81
    | `ClassType (_, name) -> TypeName.is_hidden name
54✔
82
    | `Method (parent, _) -> is_hidden (parent :> t)
2✔
83
    | `InstanceVariable (parent, _) -> is_hidden (parent :> t)
×
84
    | `Label (parent, _) -> is_hidden (parent :> t)
×
85
    | `SourceLocationMod _ | `SourceLocation _ | `SourcePage _
×
86
    | `SourceLocationInternal _ | `AssetFile _ ->
×
87
        false
88

89
  let name : [< t_pv ] id -> string = fun n -> name_aux (n :> t)
174,730✔
90

91
  let rec full_name_aux : t -> string list =
92
   fun x ->
93
    match x.iv with
240,374✔
94
    | `Root (_, name) -> [ ModuleName.to_string name ]
64,060✔
95
    | `Page (None, name) -> [ PageName.to_string name ]
29✔
96
    | `Page (Some parent, name) ->
6✔
97
        PageName.to_string name :: full_name_aux (parent :> t)
6✔
98
    | `LeafPage (None, name) -> [ PageName.to_string name ]
2✔
99
    | `LeafPage (Some parent, name) ->
×
100
        PageName.to_string name :: full_name_aux (parent :> t)
×
101
    | `Module (parent, name) ->
39,259✔
102
        ModuleName.to_string name :: full_name_aux (parent :> t)
39,259✔
103
    | `Parameter (parent, name) ->
×
104
        ModuleName.to_string name :: full_name_aux (parent :> t)
×
105
    | `Result x -> full_name_aux (x :> t)
41,779✔
106
    | `ModuleType (parent, name) ->
32,176✔
107
        ModuleTypeName.to_string name :: full_name_aux (parent :> t)
32,176✔
108
    | `Type (parent, name) ->
11,876✔
109
        TypeName.to_string name :: full_name_aux (parent :> t)
11,876✔
110
    | `Constructor (parent, name) ->
243✔
111
        ConstructorName.to_string name :: full_name_aux (parent :> t)
243✔
112
    | `Field (parent, name) ->
2✔
113
        FieldName.to_string name :: full_name_aux (parent :> t)
2✔
114
    | `UnboxedField (parent, name) ->
×
115
        UnboxedFieldName.to_string name :: full_name_aux (parent :> t)
×
116
    | `Extension (parent, name) ->
3✔
117
        ExtensionName.to_string name :: full_name_aux (parent :> t)
3✔
118
    | `ExtensionDecl (parent, _, name) ->
×
119
        ExtensionName.to_string name :: full_name_aux (parent :> t)
×
120
    | `Exception (parent, name) ->
11✔
121
        ExceptionName.to_string name :: full_name_aux (parent :> t)
11✔
122
    | `Value (parent, name) ->
50,895✔
123
        ValueName.to_string name :: full_name_aux (parent :> t)
50,895✔
124
    | `Class (parent, name) ->
3✔
125
        TypeName.to_string name :: full_name_aux (parent :> t)
3✔
126
    | `ClassType (parent, name) ->
1✔
127
        TypeName.to_string name :: full_name_aux (parent :> t)
1✔
128
    | `Method (parent, name) ->
2✔
129
        MethodName.to_string name :: full_name_aux (parent :> t)
2✔
130
    | `InstanceVariable (parent, name) ->
×
131
        InstanceVariableName.to_string name :: full_name_aux (parent :> t)
×
132
    | `Label (parent, name) ->
×
133
        LabelName.to_string name :: full_name_aux (parent :> t)
×
134
    | `SourceLocation (parent, name) ->
×
135
        DefName.to_string name :: full_name_aux (parent :> t)
×
136
    | `SourceLocationInternal (parent, name) ->
×
137
        LocalName.to_string name :: full_name_aux (parent :> t)
×
138
    | `SourceLocationMod name -> full_name_aux (name :> t)
×
139
    | `SourcePage (parent, name) -> name :: full_name_aux (parent :> t)
27✔
140
    | `AssetFile (parent, name) ->
×
141
        AssetName.to_string name :: full_name_aux (parent :> t)
×
142

143
  let fullname : [< t_pv ] id -> string list =
144
   fun n -> List.rev @@ full_name_aux (n :> t)
64,091✔
145

146
  let is_hidden : [< t_pv ] id -> bool = fun n -> is_hidden (n :> t)
330,530✔
147

148
  let rec label_parent_aux =
149
    let open Id in
150
    fun (n : non_src) ->
151
      match n with
126,662✔
152
      | { iv = `Result i; _ } -> label_parent_aux (i :> non_src)
31,114✔
153
      | { iv = `Root _; _ } as p -> (p :> label_parent)
1✔
154
      | { iv = `Page _; _ } as p -> (p :> label_parent)
×
155
      | { iv = `LeafPage _; _ } as p -> (p :> label_parent)
×
156
      | { iv = `Module (p, _); _ }
32,803✔
157
      | { iv = `ModuleType (p, _); _ }
1✔
158
      | { iv = `Parameter (p, _); _ }
×
159
      | { iv = `Class (p, _); _ }
4✔
160
      | { iv = `ClassType (p, _); _ }
2✔
161
      | { iv = `Type (p, _); _ }
11,623✔
162
      | { iv = `Extension (p, _); _ }
3✔
163
      | { iv = `ExtensionDecl (p, _, _); _ }
×
164
      | { iv = `Exception (p, _); _ }
12✔
165
      | { iv = `Value (p, _); _ } ->
50,856✔
166
          (p : signature :> label_parent)
167
      | { iv = `Label (p, _); _ } -> p
×
168
      | { iv = `Method (p, _); _ } | { iv = `InstanceVariable (p, _); _ } ->
×
169
          (p : class_signature :> label_parent)
170
      | { iv = `Constructor (p, _); _ } -> (p : datatype :> label_parent)
239✔
171
      | { iv = `Field (p, _); _ } -> (p : field_parent :> label_parent)
2✔
172
      | { iv = `UnboxedField (p, _); _ } ->
×
173
          (p : unboxed_field_parent :> label_parent)
174

175
  let label_parent n = label_parent_aux (n :> Id.non_src)
95,548✔
176

177
  let equal x y = x.ihash = y.ihash && x.ikey = y.ikey
317✔
178

179
  let hash x = x.ihash
492✔
180

181
  let compare x y = compare x.ikey y.ikey
1,451,708✔
182

183
  type any = t
184

185
  type any_pv = t_pv
186

187
  module type IdSig = sig
188
    type t
189
    type t_pv
190
    val equal : t -> t -> bool
191
    val hash : t -> int
192
    val compare : t -> t -> int
193
  end
194

195
  module Any = struct
196
    type t = any
197
    type t_pv = any_pv
198
    let equal = equal
199
    let hash = hash
200
    let compare = compare
201
  end
202

203
  module Signature = struct
204
    type t = Id.signature
205
    type t_pv = Id.signature_pv
206
    let equal = equal
207
    let hash = hash
208
    let compare = compare
209
  end
210

211
  module ClassSignature = struct
212
    type t = Id.class_signature
213
    type t_pv = Id.class_signature_pv
214
    let equal = equal
215
    let hash = hash
216
    let compare = compare
217
  end
218

219
  module DataType = struct
220
    type t = Id.datatype
221
    type t_pv = Id.datatype_pv
222
  end
223

224
  module FieldParent = struct
225
    type t = Paths_types.Identifier.field_parent
226
    type t_pv = Paths_types.Identifier.field_parent_pv
227
  end
228

229
  module UnboxedFieldParent = struct
230
    type t = Paths_types.Identifier.unboxed_field_parent
231
    type t_pv = Paths_types.Identifier.unboxed_field_parent_pv
232
  end
233

234
  module LabelParent = struct
235
    type t = Id.label_parent
236
    type t_pv = Id.label_parent_pv
237
    let equal = equal
238
    let hash = hash
239
    let compare = compare
240
  end
241

242
  module RootModule = struct
243
    type t = Id.root_module
244
    type t_pv = Id.root_module_pv
245
    let equal = equal
246
    let hash = hash
247
    let compare = compare
248
  end
249

250
  module Module = struct
251
    type t = Id.module_
252
    type t_pv = Id.module_pv
253
    let equal = equal
254
    let hash = hash
255
    let compare = compare
256
  end
257

258
  module FunctorParameter = struct
259
    type t = Id.functor_parameter
260
    type t_pv = Id.functor_parameter_pv
261
    let equal = equal
262
    let hash = hash
263
    let compare = compare
264

265
    let functor_arg_pos { iv = `Parameter (p, _); _ } =
266
      let rec inner_sig = function
3,926✔
267
        | `Result { iv = p; _ } -> 1 + inner_sig p
369✔
268
        | `Module _ | `ModuleType _ | `Root _ | `Parameter _ -> 1
×
269
      in
270
      inner_sig p.iv
271
  end
272

273
  module FunctorResult = struct
274
    type t = Id.functor_result
275
    type t_pv = Id.functor_result_pv
276
  end
277

278
  module ModuleType = struct
279
    type t = Id.module_type
280
    type t_pv = Id.module_type_pv
281
    let equal = equal
282
    let hash = hash
283
    let compare = compare
284
  end
285

286
  module Type = struct
287
    type t = Id.type_
288
    type t_pv = Id.type_pv
289
    let equal = equal
290
    let hash = hash
291
    let compare = compare
292
  end
293

294
  module Constructor = struct
295
    type t = Id.constructor
296
    type t_pv = Id.constructor_pv
297
  end
298

299
  module Field = struct
300
    type t = Id.field
301
    type t_pv = Id.field_pv
302
  end
303

304
  module UnboxedField = struct
305
    type t = Id.unboxed_field
306
    type t_pv = Id.unboxed_field_pv
307
  end
308

309
  module Extension = struct
310
    type t = Id.extension
311
    type t_pv = Id.extension_pv
312
  end
313

314
  module ExtensionDecl = struct
315
    type t = Paths_types.Identifier.extension_decl
316

317
    type t_pv = Paths_types.Identifier.extension_decl_pv
318

319
    let equal = equal
320

321
    let hash = hash
322

323
    let compare = compare
324
  end
325

326
  module Exception = struct
327
    type t = Id.exception_
328
    type t_pv = Id.exception_pv
329
  end
330

331
  module Value = struct
332
    type t = Id.value
333
    type t_pv = Id.value_pv
334
  end
335

336
  module Class = struct
337
    type t = Id.class_
338
    type t_pv = Id.class_pv
339
    let equal = equal
340
    let hash = hash
341
    let compare = compare
342
  end
343

344
  module ClassType = struct
345
    type t = Id.class_type
346
    type t_pv = Id.class_type_pv
347
    let equal = equal
348
    let hash = hash
349
    let compare = compare
350
  end
351

352
  module Method = struct
353
    type t = Id.method_
354
    type t_pv = Id.method_pv
355
  end
356

357
  module InstanceVariable = struct
358
    type t = Id.instance_variable
359
    type t_pv = Id.instance_variable_pv
360
  end
361

362
  module Label = struct
363
    type t = Paths_types.Identifier.label
364
    type t_pv = Paths_types.Identifier.label_pv
365
    let equal = equal
366
    let hash = hash
367
    let compare = compare
368
  end
369

370
  module Page = struct
371
    type t = Id.page
372
    type t_pv = Id.page_pv
373
  end
374

375
  module LeafPage = struct
376
    type t = Id.leaf_page
377
    type t_pv = Id.leaf_page_pv
378
    let equal = equal
379
    let hash = hash
380
  end
381

382
  module ContainerPage = struct
383
    type t = Id.container_page
384
    type t_pv = Id.container_page_pv
385
    let equal = equal
386
    let hash = hash
387
  end
388

389
  module NonSrc = struct
390
    type t = Paths_types.Identifier.non_src
391
    type t_pv = Paths_types.Identifier.non_src_pv
392

393
    let equal x y = x.ihash = y.ihash && x.ikey = y.ikey
×
394

395
    let hash x = x.ihash
×
396
  end
397

398
  module SourcePage = struct
399
    type t = Id.source_page
400
    type t_pv = Id.source_page_pv
401

402
    let equal = equal
403
    let hash = hash
404
  end
405

406
  module SourceLocation = struct
407
    type t = Paths_types.Identifier.source_location
408
    type t_pv = Paths_types.Identifier.source_location_pv
409
  end
410

411
  module AssetFile = struct
412
    type t = Id.asset_file
413
    type t_pv = Id.asset_file_pv
414
  end
415

416
  module OdocId = struct
417
    type t = Id.odoc_id
418
    type t_pv = Id.odoc_id_pv
419
  end
420

421
  module Path = struct
422
    module Module = struct
423
      type t = Id.path_module
424
      type t_pv = Id.path_module_pv
425
      let equal = equal
426
      let hash = hash
427
      let compare = compare
428
    end
429

430
    module ModuleType = struct
431
      type t = Id.path_module_type
432
      type t_pv = Id.module_type_pv
433
      let equal = equal
434
      let hash = hash
435
      let compare = compare
436
    end
437

438
    module Type = struct
439
      type t = Id.path_type
440
      type t_pv = Id.path_type_pv
441
      let equal = equal
442
      let hash = hash
443
      let compare = compare
444
    end
445

446
    module Value = struct
447
      type t = Id.path_value
448
      type t_pv = Id.value_pv
449
      let equal = equal
450
      let hash = hash
451
      let compare = compare
452
    end
453

454
    module ClassType = struct
455
      type t = Id.path_class_type
456
      type t_pv = Id.path_class_type_pv
457
      let equal = equal
458
      let hash = hash
459
      let compare = compare
460
    end
461

462
    type t = Id.path_any
463
  end
464

465
  module Maps = struct
466
    module Any = Map.Make (Any)
467
    module FunctorParameter = Map.Make (FunctorParameter)
468
    module Module = Map.Make (Module)
469
    module ModuleType = Map.Make (ModuleType)
470
    module Type = Map.Make (Type)
471
    module Class = Map.Make (Class)
472
    module ClassType = Map.Make (ClassType)
473
    module Label = Map.Make (Label)
474

475
    module Path = struct
476
      module Module = Map.Make (Path.Module)
477
      module ModuleType = Map.Make (Path.ModuleType)
478
      module Type = Map.Make (Path.Type)
479
      module ClassType = Map.Make (Path.ClassType)
480
    end
481
  end
482

483
  module Mk = struct
484
    let mk_fresh to_str ty f x =
485
      let ikey = Printf.sprintf "%s_%s" ty (to_str x) in
33✔
486
      let ihash = Hashtbl.hash ikey in
33✔
487
      { iv = f x; ihash; ikey }
33✔
488

489
    let mk_parent to_str ty f (parent, x) =
490
      let ikey = Printf.sprintf "%s_%s.%s" ty (to_str x) parent.ikey in
94,032✔
491
      let ihash = Hashtbl.hash ikey in
94,032✔
492

493
      { iv = f (parent, x); ihash; ikey }
94,032✔
494

495
    let mk_parent_opt to_str ty f (parent_opt, x) =
496
      let ikey =
1,405✔
497
        match parent_opt with
498
        | None -> Printf.sprintf "%s_%s" ty (to_str x)
1,052✔
499
        | Some p -> Printf.sprintf "%s_%s.%s" ty (to_str x) p.ikey
353✔
500
      in
501
      let ihash = Hashtbl.hash ikey in
502
      { iv = f (parent_opt, x); ihash; ikey }
1,405✔
503

504
    let page :
505
        ContainerPage.t option * PageName.t ->
506
        [> `Page of ContainerPage.t option * PageName.t ] id =
507
      mk_parent_opt PageName.to_string "p" (fun (p, n) -> `Page (p, n))
727✔
508

509
    let leaf_page :
510
        ContainerPage.t option * PageName.t ->
511
        [> `LeafPage of ContainerPage.t option * PageName.t ] id =
512
      mk_parent_opt PageName.to_string "lp" (fun (p, n) -> `LeafPage (p, n))
146✔
513

514
    let asset_file : Page.t * AssetName.t -> AssetFile.t =
515
      mk_parent AssetName.to_string "asset" (fun (p, n) -> `AssetFile (p, n))
6✔
516

517
    let source_page (container_page, name) =
518
      mk_parent
27✔
519
        (fun x -> x)
27✔
520
        "sp"
521
        (fun (p, rp) -> `SourcePage (p, rp))
27✔
522
        (container_page, name)
523

524
    let root :
525
        ContainerPage.t option * ModuleName.t ->
526
        [> `Root of ContainerPage.t option * ModuleName.t ] id =
527
      mk_parent_opt ModuleName.to_string "r" (fun (p, n) -> `Root (p, n))
532✔
528

529
    let implementation =
530
      mk_fresh
1,464✔
531
        (fun s -> s)
33✔
532
        "impl"
533
        (fun s -> `Implementation (ModuleName.make_std s))
33✔
534

535
    let module_ :
536
        Signature.t * ModuleName.t ->
537
        [> `Module of Signature.t * ModuleName.t ] id =
538
      mk_parent ModuleName.to_string "m" (fun (p, n) -> `Module (p, n))
1,464✔
539

540
    let parameter :
541
        Signature.t * ModuleName.t ->
542
        [> `Parameter of Signature.t * ModuleName.t ] id =
543
      mk_parent ModuleName.to_string "p" (fun (p, n) -> `Parameter (p, n))
59✔
544

545
    let result : Signature.t -> [> `Result of Signature.t ] id =
546
     fun s ->
547
      mk_parent (fun () -> "__result__") "" (fun (s, ()) -> `Result s) (s, ())
150✔
548

549
    let module_type :
550
        Signature.t * ModuleTypeName.t ->
551
        [> `ModuleType of Signature.t * ModuleTypeName.t ] id =
552
      mk_parent ModuleTypeName.to_string "mt" (fun (p, n) -> `ModuleType (p, n))
981✔
553

554
    let class_ :
555
        Signature.t * TypeName.t -> [> `Class of Signature.t * TypeName.t ] id =
556
      mk_parent TypeName.to_string "c" (fun (p, n) -> `Class (p, n))
52✔
557

558
    let class_type :
559
        Signature.t * TypeName.t ->
560
        [> `ClassType of Signature.t * TypeName.t ] id =
561
      mk_parent TypeName.to_string "ct" (fun (p, n) -> `ClassType (p, n))
22✔
562

563
    let type_ :
564
        Signature.t * TypeName.t -> [> `Type of Signature.t * TypeName.t ] id =
565
      mk_parent TypeName.to_string "t" (fun (p, n) -> `Type (p, n))
1,464✔
566

567
    let core_type =
568
      mk_fresh (fun s -> s) "coret" (fun s -> `CoreType (TypeName.make_std s))
×
569

570
    let constructor :
571
        DataType.t * ConstructorName.t ->
572
        [> `Constructor of DataType.t * ConstructorName.t ] id =
573
      mk_parent ConstructorName.to_string "ctor" (fun (p, n) ->
1,464✔
574
          `Constructor (p, n))
203✔
575

576
    let field :
577
        FieldParent.t * FieldName.t ->
578
        [> `Field of FieldParent.t * FieldName.t ] id =
579
      mk_parent FieldName.to_string "fld" (fun (p, n) -> `Field (p, n))
48✔
580

581
    let unboxed_field :
582
        UnboxedFieldParent.t * UnboxedFieldName.t ->
583
        [> `UnboxedField of UnboxedFieldParent.t * UnboxedFieldName.t ] id =
584
      mk_parent UnboxedFieldName.to_string "unboxedfld" (fun (p, n) ->
1,464✔
585
          `UnboxedField (p, n))
×
586

587
    let extension :
588
        Signature.t * ExtensionName.t ->
589
        [> `Extension of Signature.t * ExtensionName.t ] id =
590
      mk_parent ExtensionName.to_string "extn" (fun (p, n) -> `Extension (p, n))
41✔
591

592
    let extension_decl :
593
        Signature.t * (ExtensionName.t * ExtensionName.t) ->
594
        [> `ExtensionDecl of Signature.t * ExtensionName.t * ExtensionName.t ]
595
        id =
596
      mk_parent
1,464✔
597
        (fun (n, m) ->
598
          ExtensionName.to_string n ^ "." ^ ExtensionName.to_string m)
4✔
599
        "extn-decl"
600
        (fun (p, (n, m)) -> `ExtensionDecl (p, n, m))
4✔
601

602
    let exception_ :
603
        Signature.t * ExceptionName.t ->
604
        [> `Exception of Signature.t * ExceptionName.t ] id =
605
      mk_parent ExceptionName.to_string "exn" (fun (p, n) -> `Exception (p, n))
143✔
606

607
    let value :
608
        Signature.t * ValueName.t -> [> `Value of Signature.t * ValueName.t ] id
609
        =
610
      mk_parent ValueName.to_string "v" (fun (p, n) -> `Value (p, n))
607✔
611

612
    let method_ :
613
        ClassSignature.t * MethodName.t ->
614
        [> `Method of ClassSignature.t * MethodName.t ] id =
615
      mk_parent MethodName.to_string "m" (fun (p, n) -> `Method (p, n))
40✔
616

617
    let instance_variable :
618
        ClassSignature.t * InstanceVariableName.t ->
619
        [> `InstanceVariable of ClassSignature.t * InstanceVariableName.t ] id =
620
      mk_parent InstanceVariableName.to_string "iv" (fun (p, n) ->
1,464✔
621
          `InstanceVariable (p, n))
6✔
622

623
    let label :
624
        LabelParent.t * LabelName.t ->
625
        [> `Label of LabelParent.t * LabelName.t ] id =
626
      mk_parent LabelName.to_string "l" (fun (p, n) -> `Label (p, n))
419✔
627

628
    let source_location :
629
        SourcePage.t * DefName.t ->
630
        [> `SourceLocation of SourcePage.t * DefName.t ] id =
631
      mk_parent DefName.to_string "sl" (fun (p, n) -> `SourceLocation (p, n))
107✔
632

633
    let source_location_mod :
634
        SourcePage.t -> [> `SourceLocationMod of SourcePage.t ] id =
635
     fun s ->
636
      mk_parent
35✔
637
        (fun () -> "__slm__")
35✔
638
        ""
639
        (fun (s, ()) -> `SourceLocationMod s)
35✔
640
        (s, ())
641

642
    let source_location_int :
643
        SourcePage.t * LocalName.t ->
644
        [> `SourceLocationInternal of SourcePage.t * LocalName.t ] id =
645
      mk_parent LocalName.to_string "sli" (fun (p, n) ->
1,464✔
646
          `SourceLocationInternal (p, n))
4✔
647
  end
648

649
  (* Counter for generating unique synthetic parents for include expressions.
650
     Items inside an include's module type expression need a different parent
651
     to avoid identifier conflicts with items in the enclosing signature. *)
652
  let include_parent_counter = ref 0
653

654
  (* Create a synthetic parent identifier for items inside an include's module
655
     type expression. Uses a lowercase module name (illegal in normal OCaml)
656
     to ensure no clashes with real identifiers. *)
657
  let fresh_include_parent (parent : Signature.t) : Signature.t =
658
    incr include_parent_counter;
132✔
659
    let name = Printf.sprintf "include%d_" !include_parent_counter in
132✔
660
    (Mk.module_ (parent, ModuleName.make_std name) :> Signature.t)
132✔
661

662
  let module_arg_parent_counter = ref 0
663

664
  (* Create a synthetic parent identifier for module arguments, which can't have
665
     unique identifier, as they can be introduced multiple times with the same
666
     name in a single type expression . *)
667
  let fresh_module_arg_parent () : Signature.t =
668
    incr module_arg_parent_counter;
×
669
    let name = Printf.sprintf "module_arg_%d_" !module_arg_parent_counter in
×
670
    (Mk.root (None, ModuleName.hidden_of_string name) :> Signature.t)
×
671

672
  module Hashtbl = struct
673
    module Any = Hashtbl.Make (Any)
674
    module ContainerPage = Hashtbl.Make (ContainerPage)
675
    module LeafPage = Hashtbl.Make (LeafPage)
676
    module RootModule = Hashtbl.Make (RootModule)
677
    module SourcePage = Hashtbl.Make (SourcePage)
678
  end
679
end
680

681
module Path = struct
682
  type t = Paths_types.Path.any
683

684
  let rec is_resolved_hidden :
685
      weak_canonical_test:bool -> Paths_types.Resolved_path.any -> bool =
686
   fun ~weak_canonical_test x ->
687
    let open Paths_types.Resolved_path in
205,999✔
688
    let rec inner : Paths_types.Resolved_path.any -> bool = function
689
      | `Identifier { iv = `ModuleType (_, m); _ }
2,459✔
690
        when Names.ModuleTypeName.is_hidden m ->
2,459✔
691
          true
×
692
      | `Identifier { iv = `Type (_, t); _ } when Names.TypeName.is_hidden t ->
95,212✔
693
          true
19✔
694
      | `Identifier { iv = `Module (_, m); _ } when Names.ModuleName.is_hidden m
31,588✔
695
        ->
696
          true
2✔
697
      | `Identifier id -> Identifier.is_hidden id
180,146✔
698
      | `Canonical (_, `Resolved _) -> false
716✔
699
      | `Canonical (x, _) ->
1✔
700
          (not weak_canonical_test) && inner (x : module_ :> any)
1✔
701
      | `Hidden _ -> true
70✔
702
      | `Subst (p1, p2) ->
48✔
703
          inner (p1 : module_type :> any) || inner (p2 : module_ :> any)
×
704
      | `Module (p, _) -> inner (p : module_ :> any)
3,228✔
705
      | `Apply (p, _) -> inner (p : module_ :> any)
96✔
706
      | `ModuleType (_, m) when Names.ModuleTypeName.is_hidden m -> true
×
707
      | `ModuleType (p, _) -> inner (p : module_ :> any)
810✔
708
      | `Type (_, t) when Names.TypeName.is_hidden t -> true
×
709
      | `CoreType t -> Names.TypeName.is_hidden t
25,108✔
710
      | `Type (p, _) -> inner (p : module_ :> any)
59,854✔
711
      | `Value (_, t) when Names.ValueName.is_hidden t -> true
×
712
      | `Value (p, _) -> inner (p : module_ :> any)
11✔
713
      | `Class (p, _) -> inner (p : module_ :> any)
20✔
714
      | `ClassType (p, _) -> inner (p : module_ :> any)
×
715
      | `Alias (dest, `Resolved src) ->
×
716
          inner (dest : module_ :> any) && inner (src : module_ :> any)
×
717
      | `Alias (dest, src) ->
21,230✔
718
          inner (dest : module_ :> any)
21,230✔
719
          && is_path_hidden (src :> Paths_types.Path.any)
×
720
      | `AliasModuleType (p1, p2) ->
326✔
721
          inner (p1 : module_type :> any) && inner (p2 : module_type :> any)
×
722
      | `SubstT (p1, p2) -> inner (p1 :> any) || inner (p2 :> any)
×
723
      | `Substituted m -> inner (m :> any)
41,334✔
724
      | `SubstitutedMT m -> inner (m :> any)
×
725
      | `SubstitutedT m -> inner (m :> any)
×
726
      | `SubstitutedCT m -> inner (m :> any)
×
727
      | `CanonicalModuleType (_, `Resolved _) -> false
4✔
728
      | `CanonicalModuleType (x, _) -> inner (x : module_type :> any)
×
729
      | `CanonicalType (_, `Resolved _) -> false
14✔
730
      | `CanonicalType (x, _) -> inner (x : type_ :> any)
×
731
      | `OpaqueModule m -> inner (m :> any)
17✔
732
      | `OpaqueModuleType mt -> inner (mt :> any)
543✔
NEW
733
      | `Unbox mt -> inner (mt :> any)
×
734
    in
735
    inner x
736

737
  and is_path_hidden : Paths_types.Path.any -> bool =
738
    let open Paths_types.Path in
739
    function
740
    | `Resolved r -> is_resolved_hidden ~weak_canonical_test:false r
183,431✔
741
    | `Identifier (id, hidden) -> hidden || Identifier.is_hidden id
×
742
    | `Substituted r -> is_path_hidden (r :> any)
×
743
    | `SubstitutedMT r -> is_path_hidden (r :> any)
×
744
    | `SubstitutedT r -> is_path_hidden (r :> any)
×
745
    | `SubstitutedCT r -> is_path_hidden (r :> any)
×
NEW
746
    | `Unbox r -> is_path_hidden (r :> any)
×
747
    | `Root s -> ModuleName.is_hidden s
10✔
748
    | `Forward _ -> false
×
749
    | `Dot (p, n) ->
629✔
750
        ModuleName.is_hidden n || is_path_hidden (p : module_ :> any)
×
751
    | `DotMT (p, n) ->
×
752
        ModuleTypeName.is_hidden n || is_path_hidden (p : module_ :> any)
×
753
    | `DotT (p, n) ->
1✔
754
        TypeName.is_hidden n || is_path_hidden (p : module_ :> any)
×
755
    | `DotV (p, n) ->
×
756
        ValueName.is_hidden n || is_path_hidden (p : module_ :> any)
×
757
    | `Apply (p1, p2) ->
17✔
758
        is_path_hidden (p1 : module_ :> any)
×
759
        || is_path_hidden (p2 : module_ :> any)
760

761
  module Resolved = struct
762
    type t = Paths_types.Resolved_path.any
763

764
    let rec parent_module_type_identifier :
765
        Paths_types.Resolved_path.module_type -> Identifier.ModuleType.t option
766
        = function
767
      | `Identifier id -> Some (id : Identifier.ModuleType.t)
216✔
768
      | `ModuleType (m, n) -> (
92✔
769
          match parent_module_identifier m with
770
          | None -> None
×
771
          | Some p -> Some (Identifier.Mk.module_type (p, n)))
92✔
772
      | `SubstT (m, _n) -> parent_module_type_identifier m
×
773
      | `CanonicalModuleType (_, `Resolved p) -> parent_module_type_identifier p
×
774
      | `CanonicalModuleType (p, _) -> parent_module_type_identifier p
×
775
      | `OpaqueModuleType mt -> parent_module_type_identifier mt
×
776
      | `SubstitutedMT m -> parent_module_type_identifier m
×
777
      | `AliasModuleType (sub, orig) ->
41✔
778
          if is_resolved_hidden ~weak_canonical_test:false (sub :> t) then
779
            parent_module_type_identifier orig
×
780
          else parent_module_type_identifier sub
41✔
781

782
    and parent_module_identifier :
783
        Paths_types.Resolved_path.module_ -> Identifier.Signature.t option =
784
      function
785
      | `Identifier id ->
82,968✔
786
          Some (id : Identifier.Path.Module.t :> Identifier.Signature.t)
787
      | `Subst (sub, _) ->
44✔
788
          (parent_module_type_identifier sub :> Identifier.Signature.t option)
789
      | `Hidden _ -> None
14✔
790
      | `Module (m, n) -> (
5,270✔
791
          match parent_module_identifier m with
792
          | None -> None
4✔
793
          | Some p -> Some (Identifier.Mk.module_ (p, n)))
5,266✔
794
      | `Canonical (_, `Resolved p) -> parent_module_identifier p
210✔
795
      | `Canonical (p, _) -> parent_module_identifier p
4✔
796
      | `Apply (m, _) -> parent_module_identifier m
8✔
797
      | `Alias (dest, `Resolved src) ->
×
798
          if is_resolved_hidden ~weak_canonical_test:false (dest :> t) then
799
            parent_module_identifier src
×
800
          else parent_module_identifier dest
×
801
      | `Alias (dest, _src) -> parent_module_identifier dest
1,544✔
802
      | `Substituted m -> parent_module_identifier m
79,444✔
803
      | `OpaqueModule m -> parent_module_identifier m
×
804

805
    module Module = struct
806
      type t = Paths_types.Resolved_path.module_
807

808
      let is_hidden m =
809
        is_resolved_hidden (m : t :> Paths_types.Resolved_path.any)
21,113✔
810
    end
811

812
    module ModuleType = struct
813
      type t = Paths_types.Resolved_path.module_type
814

815
      let identifier : t -> Identifier.ModuleType.t option =
816
        parent_module_type_identifier
817
    end
818

819
    module Type = struct
820
      type t = Paths_types.Resolved_path.type_
821
    end
822

823
    module Value = struct
824
      type t = Paths_types.Resolved_path.value
825
    end
826

827
    module ClassType = struct
828
      type t = Paths_types.Resolved_path.class_type
829
    end
830

831
    let rec identifier : t -> Identifier.t option =
832
      let parent p f =
833
        match parent_module_identifier p with
82,824✔
834
        | None -> None
14✔
835
        | Some id -> Some (f id :> Identifier.t)
82,810✔
836
      in
837
      function
838
      | `Identifier id -> Some id
180,403✔
839
      | `CoreType _ -> None
44,259✔
840
      | `Subst (sub, _) -> identifier (sub :> t)
×
841
      | `Hidden _p -> None
22✔
842
      | `Module (m, n) -> parent m (fun p -> Identifier.Mk.module_ (p, n))
438✔
843
      | `Canonical (_, `Resolved p) -> identifier (p :> t)
371✔
844
      | `Canonical (p, _) -> identifier (p :> t)
5✔
845
      | `Apply (m, _) -> identifier (m :> t)
17✔
846
      | `Type (m, n) -> parent m (fun p -> Identifier.Mk.type_ (p, n))
82,061✔
847
      | `Value (m, n) -> parent m (fun p -> Identifier.Mk.value (p, n))
11✔
848
      | `ModuleType (m, n) ->
282✔
849
          parent m (fun p -> Identifier.Mk.module_type (p, n))
282✔
850
      | `Class (m, n) -> parent m (fun p -> Identifier.Mk.class_ (p, n))
18✔
851
      | `ClassType (m, n) -> parent m (fun p -> Identifier.Mk.class_type (p, n))
×
852
      | `Alias (dest, `Resolved src) ->
×
853
          if is_resolved_hidden ~weak_canonical_test:false (dest :> t) then
854
            identifier (src :> t)
×
855
          else identifier (dest :> t)
×
856
      | `Alias (dest, _src) -> identifier (dest :> t)
20,173✔
857
      | `AliasModuleType (sub, orig) ->
140✔
858
          if is_resolved_hidden ~weak_canonical_test:false (sub :> t) then
859
            identifier (orig :> t)
×
860
          else identifier (sub :> t)
140✔
861
      | `SubstT (p, _) -> identifier (p :> t)
×
862
      | `CanonicalModuleType (_, `Resolved p) -> identifier (p :> t)
4✔
863
      | `CanonicalModuleType (p, _) -> identifier (p :> t)
×
864
      | `CanonicalType (_, `Resolved p) -> identifier (p :> t)
8✔
865
      | `CanonicalType (p, _) -> identifier (p :> t)
×
866
      | `OpaqueModule m -> identifier (m :> t)
9✔
867
      | `OpaqueModuleType mt -> identifier (mt :> t)
260✔
868
      | `Substituted m -> identifier (m :> t)
8✔
869
      | `SubstitutedMT m -> identifier (m :> t)
×
870
      | `SubstitutedCT m -> identifier (m :> t)
×
871
      | `SubstitutedT m -> identifier (m :> t)
×
NEW
872
      | `Unbox m -> identifier (m :> t)
×
873

874
    let is_hidden r = is_resolved_hidden ~weak_canonical_test:false r
1,274✔
875
  end
876

877
  module Module = struct
878
    type t = Paths_types.Path.module_
879
  end
880

881
  module ModuleType = struct
882
    type t = Paths_types.Path.module_type
883
  end
884

885
  module Type = struct
886
    type t = Paths_types.Path.type_
887
  end
888

889
  module Value = struct
890
    type t = Paths_types.Path.value
891
  end
892

893
  module ClassType = struct
894
    type t = Paths_types.Path.class_type
895
  end
896

897
  let is_hidden = is_path_hidden
898
end
899

900
module Fragment = struct
901
  module Resolved = struct
902
    type t = Paths_types.Resolved_fragment.any
903

904
    type root = Paths_types.Resolved_fragment.root
905

906
    module Signature = struct
907
      type t = Paths_types.Resolved_fragment.signature
908

909
      let rec sgidentifier : t -> Identifier.Signature.t option = function
910
        | `Root (`ModuleType i) ->
254✔
911
            (Path.Resolved.parent_module_type_identifier i
912
              :> Identifier.Signature.t option)
913
        | `Root (`Module i) -> Path.Resolved.parent_module_identifier i
17✔
914
        | `Subst (s, _) ->
8✔
915
            (Path.Resolved.parent_module_type_identifier s
916
              :> Identifier.Signature.t option)
917
        | `Alias (i, _) -> Path.Resolved.parent_module_identifier i
16✔
918
        | `Module (m, n) -> (
17✔
919
            match sgidentifier m with
920
            | None -> None
×
921
            | Some p -> Some (Identifier.Mk.module_ (p, n)))
17✔
922
        | `OpaqueModule m -> sgidentifier (m :> t)
×
923
    end
924

925
    module Module = struct
926
      type t = Paths_types.Resolved_fragment.module_
927
    end
928

929
    module ModuleType = struct
930
      type t = Paths_types.Resolved_fragment.module_type
931
    end
932

933
    module Type = struct
934
      type t = Paths_types.Resolved_fragment.type_
935
    end
936

937
    type leaf = Paths_types.Resolved_fragment.leaf
938

939
    let rec identifier : t -> Identifier.t option = function
940
      | `Root (`ModuleType _r) -> assert false
941
      | `Root (`Module _r) -> assert false
942
      | `Subst (s, _) ->
×
943
          (Path.Resolved.ModuleType.identifier s :> Identifier.t option)
944
      | `Alias (p, _) ->
×
945
          (Path.Resolved.parent_module_identifier p :> Identifier.t option)
946
      | `Module (m, n) -> (
80✔
947
          match Signature.sgidentifier m with
948
          | None -> None
×
949
          | Some p -> Some (Identifier.Mk.module_ (p, n)))
80✔
950
      | `Module_type (m, n) -> (
48✔
951
          match Signature.sgidentifier m with
952
          | None -> None
×
953
          | Some p -> Some (Identifier.Mk.module_type (p, n)))
48✔
954
      | `Type (m, n) -> (
167✔
955
          match Signature.sgidentifier m with
956
          | None -> None
×
957
          | Some p -> Some (Identifier.Mk.type_ (p, n)))
167✔
958
      | `Class (m, n) -> (
×
959
          match Signature.sgidentifier m with
960
          | None -> None
×
961
          | Some p -> Some (Identifier.Mk.class_ (p, n)))
×
962
      | `ClassType (m, n) -> (
×
963
          match Signature.sgidentifier m with
964
          | None -> None
×
965
          | Some p -> Some (Identifier.Mk.class_type (p, n)))
×
966
      | `OpaqueModule m -> identifier (m :> t)
×
967

968
    let rec is_hidden : t -> bool = function
969
      | `Root (`ModuleType r) -> Path.Resolved.(is_hidden (r :> t))
254✔
970
      | `Root (`Module r) -> Path.Resolved.(is_hidden (r :> t))
17✔
971
      | `Subst (s, _) -> Path.Resolved.(is_hidden (s :> t))
8✔
972
      | `Alias (s, _) -> Path.Resolved.(is_hidden (s :> t))
16✔
973
      | `Module (m, _)
97✔
974
      | `Module_type (m, _)
48✔
975
      | `Type (m, _)
167✔
976
      | `Class (m, _)
×
977
      | `ClassType (m, _) ->
×
978
          is_hidden (m :> t)
979
      | `OpaqueModule m -> is_hidden (m :> t)
×
980
  end
981

982
  type t = Paths_types.Fragment.any
983

984
  module Signature = struct
985
    type t = Paths_types.Fragment.signature
986
  end
987

988
  module Module = struct
989
    type t = Paths_types.Fragment.module_
990
  end
991

992
  module ModuleType = struct
993
    type t = Paths_types.Fragment.module_type
994
  end
995

996
  module Type = struct
997
    type t = Paths_types.Fragment.type_
998
  end
999

1000
  type leaf = Paths_types.Fragment.leaf
1001
end
1002

1003
module Reference = struct
1004
  module Resolved = struct
1005
    open Paths_types.Resolved_reference
1006

1007
    type t = Paths_types.Resolved_reference.any
1008

1009
    let rec parent_signature_identifier :
1010
        signature -> Identifier.Signature.t option = function
1011
      | `Identifier id -> Some id
492✔
1012
      | `Hidden _s -> None
×
1013
      | `Alias (sub, orig) ->
77✔
1014
          if Path.Resolved.(is_hidden (sub :> t)) then
77✔
1015
            parent_signature_identifier (orig :> signature)
×
1016
          else
1017
            (Path.Resolved.parent_module_identifier sub
77✔
1018
              :> Identifier.Signature.t option)
1019
      | `AliasModuleType (sub, orig) ->
2✔
1020
          if Path.Resolved.(is_hidden (sub :> t)) then
2✔
1021
            parent_signature_identifier (orig :> signature)
×
1022
          else
1023
            (Path.Resolved.parent_module_type_identifier sub
2✔
1024
              :> Identifier.Signature.t option)
1025
      | `Module (m, n) -> (
84✔
1026
          match parent_signature_identifier m with
1027
          | None -> None
×
1028
          | Some p -> Some (Identifier.Mk.module_ (p, n)))
84✔
1029
      | `ModuleType (m, n) -> (
110✔
1030
          match parent_signature_identifier m with
1031
          | None -> None
×
1032
          | Some p -> Some (Identifier.Mk.module_type (p, n)))
110✔
1033

1034
    and parent_type_identifier : datatype -> Identifier.DataType.t option =
1035
      function
1036
      | `Identifier id -> Some id
9✔
1037
      | `Type (sg, s) -> (
198✔
1038
          match parent_signature_identifier sg with
1039
          | None -> None
×
1040
          | Some p -> Some (Identifier.Mk.type_ (p, s)))
198✔
1041

1042
    and parent_class_signature_identifier :
1043
        class_signature -> Identifier.ClassSignature.t option = function
1044
      | `Identifier id -> Some id
×
1045
      | `Class (sg, s) -> (
×
1046
          match parent_signature_identifier sg with
1047
          | None -> None
×
1048
          | Some p -> Some (Identifier.Mk.class_ (p, s)))
×
1049
      | `ClassType (sg, s) -> (
×
1050
          match parent_signature_identifier sg with
1051
          | None -> None
×
1052
          | Some p -> Some (Identifier.Mk.class_type (p, s)))
×
1053

1054
    and field_parent_identifier :
1055
        field_parent -> Identifier.FieldParent.t option = function
1056
      | `Identifier id -> Some id
×
1057
      | (`Hidden _ | `Alias _ | `AliasModuleType _ | `Module _ | `ModuleType _)
×
1058
        as sg ->
1059
          (parent_signature_identifier sg :> Identifier.FieldParent.t option)
1060
      | `Type _ as t ->
194✔
1061
          (parent_type_identifier t :> Identifier.FieldParent.t option)
1062

1063
    and unboxed_field_parent_identifier :
1064
        unboxed_field_parent -> Identifier.UnboxedFieldParent.t option =
1065
      function
1066
      | `Identifier id -> Some id
×
1067
      | `Type _ as t ->
×
1068
          (parent_type_identifier t :> Identifier.UnboxedFieldParent.t option)
1069

1070
    and label_parent_identifier :
1071
        label_parent -> Identifier.LabelParent.t option = function
1072
      | `Identifier id -> Some id
22✔
1073
      | (`Class _ | `ClassType _) as c ->
×
1074
          (parent_class_signature_identifier c
1075
            :> Identifier.LabelParent.t option)
1076
      | ( `Hidden _ | `Alias _ | `AliasModuleType _ | `Module _ | `ModuleType _
×
1077
        | `Type _ ) as r ->
194✔
1078
          (field_parent_identifier r :> Identifier.LabelParent.t option)
1079

1080
    and identifier : t -> Identifier.t option = function
1081
      | `Identifier id -> Some id
2,652✔
1082
      | `UnboxedField (p, n) -> (
×
1083
          match unboxed_field_parent_identifier p with
1084
          | None -> None
×
1085
          | Some p -> Some (Identifier.Mk.unboxed_field (p, n)))
×
1086
      | ( `Alias _ | `AliasModuleType _ | `Module _ | `Hidden _ | `Type _
×
1087
        | `Class _ | `ClassType _ | `ModuleType _ ) as r ->
×
1088
          (label_parent_identifier r :> Identifier.t option)
1089
      | `Field (p, n) -> (
×
1090
          match field_parent_identifier p with
1091
          | None -> None
×
1092
          | Some p -> Some (Identifier.Mk.field (p, n)))
×
1093
      | `PolyConstructor (s, n) -> (
8✔
1094
          (* Uses an identifier for constructor even though it is not
1095
             one. Document must make the links correspond. *)
1096
          match parent_type_identifier s with
1097
          | None -> None
×
1098
          | Some p -> Some (Identifier.Mk.constructor (p, n)))
8✔
1099
      | `Constructor (s, n) -> (
5✔
1100
          match parent_type_identifier s with
1101
          | None -> None
×
1102
          | Some p -> Some (Identifier.Mk.constructor (p, n)))
5✔
1103
      | `Extension (p, q) -> (
3✔
1104
          match parent_signature_identifier p with
1105
          | None -> None
×
1106
          | Some p -> Some (Identifier.Mk.extension (p, q)))
3✔
1107
      | `ExtensionDecl (p, q, r) -> (
2✔
1108
          match parent_signature_identifier p with
1109
          | None -> None
×
1110
          | Some p -> Some (Identifier.Mk.extension_decl (p, (q, r))))
2✔
1111
      | `Exception (p, q) -> (
126✔
1112
          match parent_signature_identifier p with
1113
          | None -> None
×
1114
          | Some p -> Some (Identifier.Mk.exception_ (p, q)))
126✔
1115
      | `Value (p, q) -> (
36✔
1116
          match parent_signature_identifier p with
1117
          | None -> None
×
1118
          | Some p -> Some (Identifier.Mk.value (p, q)))
36✔
1119
      | `Method (p, q) -> (
×
1120
          match parent_class_signature_identifier p with
1121
          | None -> None
×
1122
          | Some p -> Some (Identifier.Mk.method_ (p, q)))
×
1123
      | `InstanceVariable (p, q) -> (
×
1124
          match parent_class_signature_identifier p with
1125
          | None -> None
×
1126
          | Some p -> Some (Identifier.Mk.instance_variable (p, q)))
×
1127
      | `Label (p, q) -> (
54✔
1128
          match label_parent_identifier p with
1129
          | None -> None
×
1130
          | Some p -> Some (Identifier.Mk.label (p, q)))
54✔
1131

1132
    module Signature = struct
1133
      type t = Paths_types.Resolved_reference.signature
1134
    end
1135

1136
    module ClassSignature = struct
1137
      type t = Paths_types.Resolved_reference.class_signature
1138
    end
1139

1140
    module DataType = struct
1141
      type t = Paths_types.Resolved_reference.datatype
1142
    end
1143

1144
    module FieldParent = struct
1145
      type t = Paths_types.Resolved_reference.field_parent
1146
    end
1147

1148
    module UnboxedFieldParent = struct
1149
      type t = Paths_types.Resolved_reference.unboxed_field_parent
1150
    end
1151

1152
    module LabelParent = struct
1153
      type t = Paths_types.Resolved_reference.label_parent
1154
    end
1155

1156
    module Module = struct
1157
      type t = Paths_types.Resolved_reference.module_
1158
    end
1159

1160
    module ModuleType = struct
1161
      type t = Paths_types.Resolved_reference.module_type
1162
    end
1163

1164
    module Type = struct
1165
      type t = Paths_types.Resolved_reference.type_
1166
    end
1167

1168
    module Constructor = struct
1169
      type t = Paths_types.Resolved_reference.constructor
1170
    end
1171

1172
    module Field = struct
1173
      type t = Paths_types.Resolved_reference.field
1174
    end
1175

1176
    module UnboxedField = struct
1177
      type t = Paths_types.Resolved_reference.unboxed_field
1178
    end
1179

1180
    module Extension = struct
1181
      type t = Paths_types.Resolved_reference.extension
1182
    end
1183

1184
    module ExtensionDecl = struct
1185
      type t = Paths_types.Resolved_reference.extension_decl
1186
    end
1187

1188
    module Exception = struct
1189
      type t = Paths_types.Resolved_reference.exception_
1190
    end
1191

1192
    module Value = struct
1193
      type t = Paths_types.Resolved_reference.value
1194
    end
1195

1196
    module Class = struct
1197
      type t = Paths_types.Resolved_reference.class_
1198
    end
1199

1200
    module ClassType = struct
1201
      type t = Paths_types.Resolved_reference.class_type
1202
    end
1203

1204
    module Method = struct
1205
      type t = Paths_types.Resolved_reference.method_
1206
    end
1207

1208
    module InstanceVariable = struct
1209
      type t = Paths_types.Resolved_reference.instance_variable
1210
    end
1211

1212
    module Label = struct
1213
      type t = Paths_types.Resolved_reference.label
1214
    end
1215

1216
    module Page = struct
1217
      type t = Paths_types.Resolved_reference.page
1218
    end
1219

1220
    module Asset = struct
1221
      let identifier = function `Identifier id -> id
9✔
1222

1223
      type t = Paths_types.Resolved_reference.asset
1224
    end
1225
  end
1226

1227
  type t = Paths_types.Reference.any
1228

1229
  type tag_any = Paths_types.Reference.tag_any
1230
  type tag_hierarchy = Paths_types.Reference.tag_hierarchy
1231

1232
  module Signature = struct
1233
    type t = Paths_types.Reference.signature
1234
  end
1235

1236
  module ClassSignature = struct
1237
    type t = Paths_types.Reference.class_signature
1238
  end
1239

1240
  module DataType = struct
1241
    type t = Paths_types.Reference.datatype
1242
  end
1243

1244
  module FragmentTypeParent = struct
1245
    type t = Paths_types.Reference.fragment_type_parent
1246
  end
1247

1248
  module LabelParent = struct
1249
    type t = Paths_types.Reference.label_parent
1250
  end
1251

1252
  module Module = struct
1253
    type t = Paths_types.Reference.module_
1254
  end
1255

1256
  module ModuleType = struct
1257
    type t = Paths_types.Reference.module_type
1258
  end
1259

1260
  module Type = struct
1261
    type t = Paths_types.Reference.type_
1262
  end
1263

1264
  module Constructor = struct
1265
    type t = Paths_types.Reference.constructor
1266
  end
1267

1268
  module Field = struct
1269
    type t = Paths_types.Reference.field
1270
  end
1271

1272
  module UnboxedField = struct
1273
    type t = Paths_types.Reference.unboxed_field
1274
  end
1275

1276
  module Extension = struct
1277
    type t = Paths_types.Reference.extension
1278
  end
1279

1280
  module ExtensionDecl = struct
1281
    type t = Paths_types.Reference.extension_decl
1282
  end
1283

1284
  module Exception = struct
1285
    type t = Paths_types.Reference.exception_
1286
  end
1287

1288
  module Value = struct
1289
    type t = Paths_types.Reference.value
1290
  end
1291

1292
  module Class = struct
1293
    type t = Paths_types.Reference.class_
1294
  end
1295

1296
  module ClassType = struct
1297
    type t = Paths_types.Reference.class_type
1298
  end
1299

1300
  module Method = struct
1301
    type t = Paths_types.Reference.method_
1302
  end
1303

1304
  module InstanceVariable = struct
1305
    type t = Paths_types.Reference.instance_variable
1306
  end
1307

1308
  module Label = struct
1309
    type t = Paths_types.Reference.label
1310
  end
1311

1312
  module Page = struct
1313
    type t = Paths_types.Reference.page
1314
  end
1315

1316
  module Asset = struct
1317
    type t = Paths_types.Reference.asset
1318
  end
1319

1320
  module Hierarchy = struct
1321
    type t = Paths_types.Reference.hierarchy
1322
  end
1323
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc