Skip to content

Commit b12bf35

Browse files
committed
Make module paths in jkind match the compiler
1 parent f38ea92 commit b12bf35

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

src/ocaml/typing/jkind.ml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ open Jkind_types
1717
open Jkind_axis
1818
open Types
1919

20-
module Le_result = Misc_stdlib.Le_result
20+
(* Merlin-specific: change some module paths to match the compiler *)
2121
module Misc = struct
2222
include Misc
2323
module Stdlib = Misc_stdlib
24+
include Misc_stdlib
2425
end
2526

2627
[@@@warning "+9"]
@@ -54,7 +55,7 @@ module Sub_result = struct
5455
| Less
5556
| Not_le of Sub_failure_reason.t Nonempty_list.t
5657

57-
let of_le_result ~failure_reason (le_result : Le_result.t) =
58+
let of_le_result ~failure_reason (le_result : Misc.Le_result.t) =
5859
match le_result with
5960
| Less -> Less
6061
| Equal -> Equal
@@ -140,7 +141,7 @@ module Layout = struct
140141
| Product ts ->
141142
Option.map
142143
(fun x -> Sort.Const.Product x)
143-
(Misc_stdlib.List.map_option get_sort ts)
144+
(Misc.Stdlib.List.map_option get_sort ts)
144145

145146
let of_sort s =
146147
let rec of_sort : Sort.t -> _ = function
@@ -215,7 +216,7 @@ module Layout = struct
215216
and to_product_sort ts =
216217
Option.map
217218
(fun x -> Sort.Product x)
218-
(Misc_stdlib.List.map_option to_sort ts)
219+
(Misc.Stdlib.List.map_option to_sort ts)
219220

220221
let rec get : Sort.t t -> Sort.Flat.t t =
221222
let rec flatten_sort : Sort.t -> Sort.Flat.t t = function
@@ -271,15 +272,15 @@ module Layout = struct
271272
| (Any | Sort _ | Product _), _ -> false
272273

273274
let sub t1 t2 =
274-
let rec sub t1 t2 : Le_result.t =
275+
let rec sub t1 t2 : Misc.Le_result.t =
275276
match t1, t2 with
276277
| Any, Any -> Equal
277278
| _, Any -> Less
278279
| Any, _ -> Not_le
279280
| Sort s1, Sort s2 -> if Sort.equate s1 s2 then Equal else Not_le
280281
| Product ts1, Product ts2 ->
281282
if List.compare_lengths ts1 ts2 = 0
282-
then Le_result.combine_list (List.map2 sub ts1 ts2)
283+
then Misc.Le_result.combine_list (List.map2 sub ts1 ts2)
283284
else Not_le
284285
| Product ts1, Sort s2 -> (
285286
(* This case could use [to_product_sort] because every component will need
@@ -289,13 +290,13 @@ module Layout = struct
289290
match Sort.decompose_into_product s2 (List.length ts1) with
290291
| None -> Not_le
291292
| Some ss2 ->
292-
Le_result.combine_list
293+
Misc.Le_result.combine_list
293294
(List.map2 (fun t1 s2 -> sub t1 (Sort s2)) ts1 ss2))
294295
| Sort s1, Product ts2 -> (
295296
match Sort.decompose_into_product s1 (List.length ts2) with
296297
| None -> Not_le
297298
| Some ss1 ->
298-
Le_result.combine_list
299+
Misc.Le_result.combine_list
299300
(List.map2 (fun s1 t2 -> sub (Sort s1) t2) ss1 ts2))
300301
in
301302
Sub_result.of_le_result (sub t1 t2) ~failure_reason:(fun () ->
@@ -336,7 +337,7 @@ module Layout = struct
336337
| Sort s -> Sort.format ppf s
337338
| Product ts ->
338339
let pp_sep ppf () = Format.fprintf ppf " & " in
339-
Misc_stdlib.pp_nested_list ~nested ~pp_element ~pp_sep ppf ts
340+
Misc.pp_nested_list ~nested ~pp_element ~pp_sep ppf ts
340341
in
341342
pp_element ~nested:false ppf layout
342343
end
@@ -1357,7 +1358,7 @@ module Desc = struct
13571358
[Const.format] works better for atomic layouts, not products. *)
13581359
| Product lays ->
13591360
let pp_sep ppf () = fprintf ppf "@ & " in
1360-
Misc_stdlib.pp_nested_list ~nested ~pp_element:format_desc ~pp_sep ppf
1361+
Misc.pp_nested_list ~nested ~pp_element:format_desc ~pp_sep ppf
13611362
(List.map (fun layout -> { desc with layout }) lays)
13621363
| _ -> (
13631364
match get_const desc with
@@ -2178,7 +2179,7 @@ end = struct
21782179
let missing_cmi_hint ppf type_path =
21792180
let root_module_name p = p |> Path.head |> Ident.name in
21802181
let delete_trailing_double_underscore s =
2181-
if Misc.String.ends_with ~suffix:"__" s
2182+
if Misc.Stdlib.String.ends_with ~suffix:"__" s
21822183
then String.sub s 0 (String.length s - 2)
21832184
else s
21842185
in
@@ -3007,7 +3008,7 @@ module Debug_printers = struct
30073008
| Type_declaration p -> fprintf ppf "Type_declaration %a" Path.print p
30083009
| Type_parameter (p, var) ->
30093010
fprintf ppf "Type_parameter (%a, %a)" Path.print p
3010-
(Misc_stdlib.Option.print Misc_stdlib.String.print)
3011+
(Misc.Stdlib.Option.print Misc.Stdlib.String.print)
30113012
var
30123013
| Newtype_declaration name -> fprintf ppf "Newtype_declaration %s" name
30133014
| Constructor_type_parameter (cstr, name) ->

src/ocaml/typing/jkind_axis.ml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
(* *)
1313
(**************************************************************************)
1414

15-
(* Merlin-specific: Change the module path of Misc_stdlib.Le_result to Misc.Le_result to
16-
match the compiler *)
15+
(* Merlin-specific: change some module paths to match the compiler *)
1716
module Misc = struct
18-
module Le_result = Misc_stdlib.Le_result
17+
module Stdlib = Misc_stdlib
18+
include Misc_stdlib
1919
end
2020

2121
module type Axis_ops = sig
@@ -179,7 +179,7 @@ module Axis = struct
179179
end
180180

181181
module Axis_collection = struct
182-
module Indexed_gen (T : Misc_stdlib.T2) = struct
182+
module Indexed_gen (T : Misc.T2) = struct
183183
type 'a t_poly =
184184
{ locality : (Mode.Locality.Const.t, 'a) T.t;
185185
linearity : (Mode.Linearity.Const.t, 'a) T.t;
@@ -218,7 +218,7 @@ module Axis_collection = struct
218218
(* Since we don't have polymorphic parameters, use a record to pass the
219219
polymorphic function *)
220220
module Create = struct
221-
module Monadic (M : Misc_stdlib.Monad.S) = struct
221+
module Monadic (M : Misc.Stdlib.Monad.S) = struct
222222
type 'a f = { f : 'axis. axis:'axis Axis.t -> ('axis, 'a) T.t M.t }
223223
[@@unboxed]
224224

@@ -245,15 +245,15 @@ module Axis_collection = struct
245245
end
246246
[@@inline]
247247

248-
module Monadic_identity = Monadic (Misc_stdlib.Monad.Identity)
248+
module Monadic_identity = Monadic (Misc.Stdlib.Monad.Identity)
249249

250250
type 'a f = 'a Monadic_identity.f
251251

252252
let[@inline] f f = Monadic_identity.f f
253253
end
254254

255255
module Map = struct
256-
module Monadic (M : Misc_stdlib.Monad.S) = struct
256+
module Monadic (M : Misc.Stdlib.Monad.S) = struct
257257
type ('a, 'b) f =
258258
{ f :
259259
'axis. axis:'axis Axis.t -> ('axis, 'a) T.t -> ('axis, 'b) T.t M.t
@@ -267,7 +267,7 @@ module Axis_collection = struct
267267
end
268268
[@@inline]
269269

270-
module Monadic_identity = Monadic (Misc_stdlib.Monad.Identity)
270+
module Monadic_identity = Monadic (Misc.Stdlib.Monad.Identity)
271271

272272
type ('a, 'b) f = ('a, 'b) Monadic_identity.f
273273

@@ -299,7 +299,7 @@ module Axis_collection = struct
299299
end
300300

301301
module Map2 = struct
302-
module Monadic (M : Misc_stdlib.Monad.S) = struct
302+
module Monadic (M : Misc.Stdlib.Monad.S) = struct
303303
type ('a, 'b, 'c) f =
304304
{ f :
305305
'axis.
@@ -319,7 +319,7 @@ module Axis_collection = struct
319319
end
320320
[@@inline]
321321

322-
module Monadic_identity = Monadic (Misc_stdlib.Monad.Identity)
322+
module Monadic_identity = Monadic (Misc.Stdlib.Monad.Identity)
323323

324324
type ('a, 'b, 'c) f = ('a, 'b, 'c) Monadic_identity.f
325325

@@ -388,15 +388,15 @@ module Axis_collection = struct
388388
end
389389
end
390390

391-
module Indexed (T : Misc_stdlib.T1) = struct
391+
module Indexed (T : Misc.T1) = struct
392392
include Indexed_gen (struct
393393
type ('a, 'b) t = 'a T.t
394394
end)
395395

396396
type nonrec t = unit t
397397
end
398398

399-
module Identity = Indexed (Misc_stdlib.Monad.Identity)
399+
module Identity = Indexed (Misc.Stdlib.Monad.Identity)
400400

401401
include Indexed_gen (struct
402402
type ('a, 'b) t = 'b

src/ocaml/typing/jkind_types.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
module Misc = struct
1717
let fatal_error = Misc.fatal_error
1818
include Misc_stdlib
19+
module Stdlib = Misc_stdlib
1920
end
2021

2122
module Sort = struct
@@ -301,7 +302,7 @@ module Sort = struct
301302
| Product cs ->
302303
Option.map
303304
(fun x -> Product x)
304-
(Misc.List.map_option of_const cs)
305+
(Misc.Stdlib.List.map_option of_const cs)
305306
end
306307

307308
module Const = struct

0 commit comments

Comments
 (0)