Skip to content

Commit

Permalink
refactor: remove polymorphic comparison (#11349)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Jan 19, 2025
1 parent 0b67e44 commit caa0a81
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/dune_pkg/opam_solver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,15 @@ module Solver = struct
let compare_version a b =
match a, b with
| RealImpl a, RealImpl b -> Ordering.of_int (OpamPackage.compare a.pkg b.pkg)
| RealImpl _, _ -> Gt
| _, RealImpl _ -> Lt
| VirtualImpl (ia, _), VirtualImpl (ib, _) -> Int.compare ia ib
| VirtualImpl _, _ -> Gt
| _, VirtualImpl _ -> Lt
| Reject a, Reject b -> Ordering.of_int (OpamPackage.compare a b)
| ( (RealImpl _ | Reject _ | VirtualImpl _ | Dummy)
, (RealImpl _ | Reject _ | VirtualImpl _ | Dummy) ) -> Poly.compare b a
| Reject _, _ -> Gt
| _, Reject _ -> Lt
| Dummy, Dummy -> Eq
;;
end

Expand Down

0 comments on commit caa0a81

Please sign in to comment.