Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move conflict class #11344

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1199,7 +1199,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 @@ -1214,7 +1214,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
Loading