Skip to content

Commit da3f2bc

Browse files
committed
silence warnings
1 parent 08ac0c7 commit da3f2bc

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/ppx_import.cppo.ml

+17-10
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,15 @@ let ptype_decl_of_ttype_decl ~manifest ~subst ptype_name ttype_decl =
250250
let subst =
251251
match manifest with
252252
| Some { ptyp_desc = Ptyp_constr (_, ptype_args); ptyp_loc } ->
253-
begin try
254-
subst @ (List.map2 (fun tparam pparam ->
253+
subst @ begin try
254+
List.map2 (fun tparam pparam ->
255255
match tparam with
256-
| { desc = Tvar (Some var) } -> [`Var var, pparam]
257-
| { desc = Tvar None } -> []
258-
| _ -> assert false)
259-
ttype_decl.type_params ptype_args
260-
|> List.concat)
261-
with Invalid_argument "List.map2" ->
256+
| { desc = Tvar (Some var) } -> [`Var var, pparam]
257+
| { desc = Tvar None } -> []
258+
| _ -> assert false)
259+
ttype_decl.type_params ptype_args
260+
|> List.concat
261+
with Invalid_argument _ ->
262262
raise_errorf ~loc:ptyp_loc "Imported type has %d parameter(s), but %d are passed"
263263
(List.length ttype_decl.type_params)
264264
(List.length ptype_args)
@@ -337,15 +337,22 @@ let subst_of_manifest { ptyp_attributes; ptyp_loc } =
337337
| Some _ ->
338338
raise_errorf ~loc:ptyp_loc "Invalid [@with] syntax"
339339

340+
let uncapitalize =
341+
#if OCAML_VERSION < (4, 03, 0)
342+
String.uncapitalize
343+
#else
344+
String.uncapitalize_ascii
345+
#endif
346+
340347
let is_self_reference lid =
341348
let fn = !Location.input_name
342349
|> Filename.basename
343350
|> Filename.chop_extension
344-
|> String.uncapitalize
351+
|> uncapitalize
345352
in
346353
match lid with
347354
| Ldot (_) ->
348-
let mn = Longident.flatten lid |> List.hd |> String.uncapitalize
355+
let mn = Longident.flatten lid |> List.hd |> uncapitalize
349356
in fn = mn
350357
| _ -> false
351358

0 commit comments

Comments
 (0)