Skip to content

Commit cf0880e

Browse files
panglesdjonludlam
authored andcommitted
Occurrences: compatibility with different OCaml versions and fmt
Signed-off-by: Paul-Elliot <[email protected]>
1 parent fab7e1f commit cf0880e

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

src/loader/cmt.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,16 +382,16 @@ let rec read_module_expr env parent label_parent mexpr =
382382
Functor (f_parameter, res)
383383
#else
384384
| Tmod_functor(id, _, arg, res) ->
385-
let new_env = Env.add_parameter parent id (ModuleName.of_ident id) env in
385+
let () = Env.add_parameter parent id (ModuleName.of_ident id) env in
386386
let f_parameter =
387387
match arg with
388388
| None -> FunctorParameter.Unit
389389
| Some arg ->
390-
let id = Env.find_parameter_identifier new_env id in
390+
let id = Env.find_parameter_identifier env id in
391391
let arg = Cmti.read_module_type env (id :> Identifier.Signature.t) label_parent arg in
392392
Named { FunctorParameter. id; expr = arg; }
393393
in
394-
let res = read_module_expr new_env (Identifier.Mk.result parent) label_parent res in
394+
let res = read_module_expr env (Identifier.Mk.result parent) label_parent res in
395395
Functor(f_parameter, res)
396396
#endif
397397
| Tmod_apply _ ->

src/loader/implementation.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let rec is_persistent : Path.t -> bool = function
55
| Path.Pdot(p, _) -> is_persistent p
66
| Path.Papply(p, _) -> is_persistent p
77
#if OCAML_VERSION >= (5,1,0)
8-
| Path.Pextra_ty -> assert false
8+
| Path.Pextra_ty _ -> assert false
99
#endif
1010

1111
let pos_of_loc loc = (loc.Location.loc_start.pos_cnum, loc.loc_end.pos_cnum)
@@ -384,7 +384,7 @@ let read_cmt_infos source_id_opt id cmt_info ~count_occurrences =
384384

385385
#else
386386

387-
let read_cmt_infos _source_id_opt _id _cmt_info =
387+
let read_cmt_infos _source_id_opt _id _cmt_info ~count_occurrences:_ =
388388
(None, None)
389389

390390
#endif

src/odoc/occurrences.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ end = struct
119119
tbl
120120
end
121121

122-
let count ~dst ~warnings_options:_ directories include_hidden include_persistent =
122+
let count ~dst ~warnings_options:_ directories include_hidden include_persistent
123+
=
123124
let htbl = H.create 100 in
124125
let f () (unit : Odoc_model.Lang.Compilation_unit.t) =
125126
let incr tbl p persistent =
126127
let p = (p :> Odoc_model.Paths.Path.Resolved.t) in
127128
let id = Odoc_model.Paths.Path.Resolved.identifier p in
128-
if not (Odoc_model.Paths.Path.Resolved.is_hidden p) || include_hidden then
129-
if not persistent || include_persistent then
130-
Occtbl.add tbl id
129+
if (not (Odoc_model.Paths.Path.Resolved.is_hidden p)) || include_hidden
130+
then if (not persistent) || include_persistent then Occtbl.add tbl id
131131
in
132132
let () =
133133
List.iter
@@ -138,9 +138,11 @@ let count ~dst ~warnings_options:_ directories include_hidden include_persistent
138138
incr htbl p persistent
139139
| Value { documentation = Some (`Resolved p, persistent); _ }, _ ->
140140
incr htbl p persistent
141-
| ClassType { documentation = Some (`Resolved p, persistent); _ }, _ ->
141+
| ClassType { documentation = Some (`Resolved p, persistent); _ }, _
142+
->
142143
incr htbl p persistent
143-
| ModuleType { documentation = Some (`Resolved p, persistent); _ }, _ ->
144+
| ModuleType { documentation = Some (`Resolved p, persistent); _ }, _
145+
->
144146
incr htbl p persistent
145147
| Type { documentation = Some (`Resolved p, persistent); _ }, _ ->
146148
incr htbl p persistent

src/xref2/shape_tools.cppo.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,8 @@ type t = unit
176176

177177
let lookup_def _ _id = None
178178

179+
let lookup_value_path _ _id = None
180+
181+
let lookup_module_path _ _id = None
182+
179183
#endif

0 commit comments

Comments
 (0)