Skip to content

Commit af56666

Browse files
committed
4.02 compat: Comment-out unused code
The unused functions cannot be ignored with `ignore` without generating the partial application warning.
1 parent 5cb418b commit af56666

File tree

2 files changed

+61
-71
lines changed

2 files changed

+61
-71
lines changed

src/xref2/compile.ml

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ let type_path : Env.t -> Paths.Path.Type.t -> Paths.Path.Type.t =
2121
| Ok p' -> `Resolved Lang_of.(Path.resolved_type (empty ()) p')
2222
| Error _ -> p)
2323

24-
and value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t =
25-
fun env p ->
26-
match p with
27-
| `Resolved _ -> p
28-
| _ -> (
29-
let cp = Component.Of_Lang.(value_path (empty ()) p) in
30-
match Tools.resolve_value_path env cp with
31-
| Ok p' -> `Resolved Lang_of.(Path.resolved_value (empty ()) p')
32-
| Error _ -> p)
33-
34-
and constructor_path :
35-
Env.t -> Paths.Path.Constructor.t -> Paths.Path.Constructor.t =
36-
fun env p ->
37-
match p with
38-
| `Resolved _ -> p
39-
| _ -> (
40-
let cp = Component.Of_Lang.(constructor_path (empty ()) p) in
41-
match Tools.resolve_constructor_path env cp with
42-
| Ok p' -> `Resolved Lang_of.(Path.resolved_constructor (empty ()) p')
43-
| Error _ -> p)
24+
(* and value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t = *)
25+
(* fun env p -> *)
26+
(* match p with *)
27+
(* | `Resolved _ -> p *)
28+
(* | _ -> ( *)
29+
(* let cp = Component.Of_Lang.(value_path (empty ()) p) in *)
30+
(* match Tools.resolve_value_path env cp with *)
31+
(* | Ok p' -> `Resolved Lang_of.(Path.resolved_value (empty ()) p') *)
32+
(* | Error _ -> p) *)
33+
34+
(* and constructor_path : *)
35+
(* Env.t -> Paths.Path.Constructor.t -> Paths.Path.Constructor.t = *)
36+
(* fun env p -> *)
37+
(* match p with *)
38+
(* | `Resolved _ -> p *)
39+
(* | _ -> ( *)
40+
(* let cp = Component.Of_Lang.(constructor_path (empty ()) p) in *)
41+
(* match Tools.resolve_constructor_path env cp with *)
42+
(* | Ok p' -> `Resolved Lang_of.(Path.resolved_constructor (empty ()) p') *)
43+
(* | Error _ -> p) *)
4444

4545
and module_type_path :
4646
Env.t -> Paths.Path.ModuleType.t -> Paths.Path.ModuleType.t =
@@ -74,11 +74,6 @@ and class_type_path : Env.t -> Paths.Path.ClassType.t -> Paths.Path.ClassType.t
7474
| Ok p' -> `Resolved Lang_of.(Path.resolved_class_type (empty ()) p')
7575
| Error _ -> p)
7676

77-
let () =
78-
(* Until those are used *)
79-
ignore value_path;
80-
ignore constructor_path
81-
8277
let rec unit env t =
8378
let open Compilation_unit in
8479
let source_info =

src/xref2/link.ml

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ let rec should_reresolve : Paths.Path.Resolved.t -> bool =
129129
and should_resolve : Paths.Path.t -> bool =
130130
fun p -> match p with `Resolved p -> should_reresolve p | _ -> true
131131

132-
and should_resolve_constructor : Paths.Path.Constructor.t -> bool =
133-
fun p ->
134-
match p with
135-
| `Resolved p -> should_reresolve (p :> Paths.Path.Resolved.t)
136-
| _ -> true
132+
(* and should_resolve_constructor : Paths.Path.Constructor.t -> bool = *)
133+
(* fun p -> *)
134+
(* match p with *)
135+
(* | `Resolved p -> should_reresolve (p :> Paths.Path.Resolved.t) *)
136+
(* | _ -> true *)
137137

138138
let type_path : Env.t -> Paths.Path.Type.t -> Paths.Path.Type.t =
139139
fun env p ->
@@ -153,47 +153,42 @@ let type_path : Env.t -> Paths.Path.Type.t -> Paths.Path.Type.t =
153153
Errors.report ~what:(`Type_path cp) ~tools_error:e `Lookup;
154154
p)
155155

156-
let value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t =
157-
fun env p ->
158-
if not (should_resolve (p :> Paths.Path.t)) then p
159-
else
160-
let cp = Component.Of_Lang.(value_path (empty ()) p) in
161-
match cp with
162-
| `Resolved p ->
163-
let result = Tools.reresolve_value env p in
164-
`Resolved Lang_of.(Path.resolved_value (empty ()) result)
165-
| _ -> (
166-
match Tools.resolve_value_path env cp with
167-
| Ok p' ->
168-
let result = Tools.reresolve_value env p' in
169-
`Resolved Lang_of.(Path.resolved_value (empty ()) result)
170-
| Error e ->
171-
Errors.report ~what:(`Value_path cp) ~tools_error:e `Lookup;
172-
p)
173-
174-
let constructor_path :
175-
Env.t -> Paths.Path.Constructor.t -> Paths.Path.Constructor.t =
176-
fun env p ->
177-
if not (should_resolve_constructor p) then p
178-
else
179-
let cp = Component.Of_Lang.(constructor_path (empty ()) p) in
180-
match cp with
181-
| `Resolved p ->
182-
let result = Tools.reresolve_constructor env p in
183-
`Resolved Lang_of.(Path.resolved_constructor (empty ()) result)
184-
| _ -> (
185-
match Tools.resolve_constructor_path env cp with
186-
| Ok p' ->
187-
let result = Tools.reresolve_constructor env p' in
188-
`Resolved Lang_of.(Path.resolved_constructor (empty ()) result)
189-
| Error e ->
190-
Errors.report ~what:(`Constructor_path cp) ~tools_error:e `Lookup;
191-
p)
192-
193-
let () =
194-
(* Until those are used *)
195-
ignore value_path;
196-
ignore constructor_path
156+
(* let value_path : Env.t -> Paths.Path.Value.t -> Paths.Path.Value.t = *)
157+
(* fun env p -> *)
158+
(* if not (should_resolve (p :> Paths.Path.t)) then p *)
159+
(* else *)
160+
(* let cp = Component.Of_Lang.(value_path (empty ()) p) in *)
161+
(* match cp with *)
162+
(* | `Resolved p -> *)
163+
(* let result = Tools.reresolve_value env p in *)
164+
(* `Resolved Lang_of.(Path.resolved_value (empty ()) result) *)
165+
(* | _ -> ( *)
166+
(* match Tools.resolve_value_path env cp with *)
167+
(* | Ok p' -> *)
168+
(* let result = Tools.reresolve_value env p' in *)
169+
(* `Resolved Lang_of.(Path.resolved_value (empty ()) result) *)
170+
(* | Error e -> *)
171+
(* Errors.report ~what:(`Value_path cp) ~tools_error:e `Lookup; *)
172+
(* p) *)
173+
174+
(* let constructor_path : *)
175+
(* Env.t -> Paths.Path.Constructor.t -> Paths.Path.Constructor.t = *)
176+
(* fun env p -> *)
177+
(* if not (should_resolve_constructor p) then p *)
178+
(* else *)
179+
(* let cp = Component.Of_Lang.(constructor_path (empty ()) p) in *)
180+
(* match cp with *)
181+
(* | `Resolved p -> *)
182+
(* let result = Tools.reresolve_constructor env p in *)
183+
(* `Resolved Lang_of.(Path.resolved_constructor (empty ()) result) *)
184+
(* | _ -> ( *)
185+
(* match Tools.resolve_constructor_path env cp with *)
186+
(* | Ok p' -> *)
187+
(* let result = Tools.reresolve_constructor env p' in *)
188+
(* `Resolved Lang_of.(Path.resolved_constructor (empty ()) result) *)
189+
(* | Error e -> *)
190+
(* Errors.report ~what:(`Constructor_path cp) ~tools_error:e `Lookup; *)
191+
(* p) *)
197192

198193
let class_type_path : Env.t -> Paths.Path.ClassType.t -> Paths.Path.ClassType.t
199194
=

0 commit comments

Comments
 (0)