Skip to content

Commit 2910e0d

Browse files
committed
Avoid polymorphic comparison functions in OpamListCommand
1 parent ca23d8e commit 2910e0d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/client/opamListCommand.ml

+11-6
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ let apply_selector ~base st = function
348348
base
349349
| Tag t ->
350350
OpamPackage.Set.filter (fun nv ->
351-
get_opam st nv |> List.mem t @* OpamFile.OPAM.tags)
351+
get_opam st nv |> List.exists (String.equal t) @* OpamFile.OPAM.tags)
352352
base
353353
| From_repository repos ->
354354
let rt = st.switch_repos in
@@ -358,7 +358,8 @@ let apply_selector ~base st = function
358358
let packages =
359359
OpamPackage.keys (OpamRepositoryName.Map.find r rt.repo_opams)
360360
in
361-
if List.mem r repos then OpamPackage.Set.union packages (aux rl)
361+
if List.exists (OpamRepositoryName.equal r) repos
362+
then OpamPackage.Set.union packages (aux rl)
362363
else OpamPackage.Set.diff (aux rl) packages
363364
in
364365
aux (OpamSwitchState.repos_list st)
@@ -383,12 +384,13 @@ let apply_selector ~base st = function
383384
OpamStd.String.Map.exists
384385
(fun f -> function
385386
| OpamDirTrack.Removed -> false
386-
| _ -> rel_name = f)
387+
| _ -> rel_name = (f : string))
387388
changes)
388389
(OpamFilename.files (OpamPath.Switch.install_dir root switch))
389390
in
390391
let selections =
391-
if switch = st.switch then OpamSwitchState.selections st
392+
if OpamSwitch.equal switch st.switch then
393+
OpamSwitchState.selections st
392394
else
393395
OpamSwitchState.load_selections ~lock_kind:`Lock_none
394396
st.switch_global switch
@@ -504,7 +506,7 @@ let field_of_string ~raw =
504506
try
505507
OpamStd.List.assoc String.equal s names_fields
506508
with Not_found ->
507-
match OpamStd.List.find_opt (fun x -> s = x) opam_fields with
509+
match OpamStd.List.find_opt (fun x -> s = (x : string)) opam_fields with
508510
| Some f -> Field f
509511
| None -> OpamConsole.error_and_exit `Bad_arguments "No printer for %S" s
510512

@@ -569,7 +571,10 @@ let detail_printer ?prettify ?normalise ?(sort=false) st nv =
569571
(match OpamPinned.package_opt st nv.name with
570572
| Some nv ->
571573
let opam = get_opam st nv in
572-
if Some opam = OpamPackage.Map.find_opt nv st.repos_package_index then
574+
if
575+
OpamStd.Option.equal OpamFile.OPAM.equal
576+
(Some opam) (OpamPackage.Map.find_opt nv st.repos_package_index)
577+
then
573578
Printf.sprintf "pinned to version %s"
574579
(OpamPackage.Version.to_string nv.version % [`blue])
575580
else

0 commit comments

Comments
 (0)