Skip to content

Commit

Permalink
refactor: move conflict class (#11344)
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 5027f36 commit 1e0e1d7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/dune_pkg/opam_solver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ module Solver = struct
| VirtualImpl (_, deps) -> deps
| RealImpl impl -> impl.requires
;;

let conflict_class = function
| RealImpl impl -> OpamFile.OPAM.conflict_class impl.opam
| VirtualImpl _ -> []
| Dummy | Reject _ -> []
;;
end

let role context name = Real { context; name }
Expand Down Expand Up @@ -446,12 +452,6 @@ module Solver = struct
end)
end

let conflict_class = function
| RealImpl impl -> OpamFile.OPAM.conflict_class impl.opam
| VirtualImpl _ -> []
| Dummy | Reject _ -> []
;;

(* Opam uses conflicts, e.g.
conflicts if X {> 1} OR Y {< 1 OR > 2}
whereas 0install uses restricts, e.g.
Expand Down Expand Up @@ -661,7 +661,7 @@ module Solver = struct

(* Add [impl] to its conflict groups, if any. *)
let process t impl_var impl =
Input.conflict_class impl
Input.Impl.conflict_class impl
|> List.iter ~f:(fun name ->
let impls = var t name in
impls := impl_var :: !impls)
Expand Down Expand Up @@ -1198,7 +1198,7 @@ module Solver = struct
match Component.selected_impl component with
| None -> acc
| Some impl ->
Input.conflict_class impl
Input.Impl.conflict_class impl
|> List.fold_left ~init:acc ~f:(fun acc x ->
Input.Conflict_class.Map.set acc x role))
in
Expand All @@ -1213,7 +1213,7 @@ module Solver = struct
Some (`ClassConflict (other_role, cl))
| _ -> aux cls)
in
aux (Input.conflict_class impl)))
aux (Input.Impl.conflict_class impl)))
;;

let of_result impls =
Expand Down

0 comments on commit 1e0e1d7

Please sign in to comment.