Skip to content

Commit 1e0e1d7

Browse files
authored
refactor: move conflict class (#11344)
Signed-off-by: Rudi Grinberg <[email protected]>
1 parent 5027f36 commit 1e0e1d7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/dune_pkg/opam_solver.ml

+9-9
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ module Solver = struct
374374
| VirtualImpl (_, deps) -> deps
375375
| RealImpl impl -> impl.requires
376376
;;
377+
378+
let conflict_class = function
379+
| RealImpl impl -> OpamFile.OPAM.conflict_class impl.opam
380+
| VirtualImpl _ -> []
381+
| Dummy | Reject _ -> []
382+
;;
377383
end
378384

379385
let role context name = Real { context; name }
@@ -446,12 +452,6 @@ module Solver = struct
446452
end)
447453
end
448454

449-
let conflict_class = function
450-
| RealImpl impl -> OpamFile.OPAM.conflict_class impl.opam
451-
| VirtualImpl _ -> []
452-
| Dummy | Reject _ -> []
453-
;;
454-
455455
(* Opam uses conflicts, e.g.
456456
conflicts if X {> 1} OR Y {< 1 OR > 2}
457457
whereas 0install uses restricts, e.g.
@@ -661,7 +661,7 @@ module Solver = struct
661661

662662
(* Add [impl] to its conflict groups, if any. *)
663663
let process t impl_var impl =
664-
Input.conflict_class impl
664+
Input.Impl.conflict_class impl
665665
|> List.iter ~f:(fun name ->
666666
let impls = var t name in
667667
impls := impl_var :: !impls)
@@ -1198,7 +1198,7 @@ module Solver = struct
11981198
match Component.selected_impl component with
11991199
| None -> acc
12001200
| Some impl ->
1201-
Input.conflict_class impl
1201+
Input.Impl.conflict_class impl
12021202
|> List.fold_left ~init:acc ~f:(fun acc x ->
12031203
Input.Conflict_class.Map.set acc x role))
12041204
in
@@ -1213,7 +1213,7 @@ module Solver = struct
12131213
Some (`ClassConflict (other_role, cl))
12141214
| _ -> aux cls)
12151215
in
1216-
aux (Input.conflict_class impl)))
1216+
aux (Input.Impl.conflict_class impl)))
12171217
;;
12181218

12191219
let of_result impls =

0 commit comments

Comments
 (0)