diff --git a/src/dune_pkg/opam_solver.ml b/src/dune_pkg/opam_solver.ml index 4426997722f6..5390578b4aaa 100644 --- a/src/dune_pkg/opam_solver.ml +++ b/src/dune_pkg/opam_solver.ml @@ -346,6 +346,14 @@ module Solver = struct include T + let user_restrictions = function + | Virtual _ -> None + | Real role -> + (match Context.user_restrictions role.context role.name with + | None -> None + | Some f -> Some { kind = `Ensure; expr = OpamFormula.Atom f }) + ;; + let pp = pp_role module Map = Map.Make (T) @@ -524,14 +532,6 @@ module Solver = struct Ordering.to_int (Poly.compare b a) ;; - let user_restrictions = function - | Virtual _ -> None - | Real role -> - (match Context.user_restrictions role.context role.name with - | None -> None - | Some f -> Some { kind = `Ensure; expr = OpamFormula.Atom f }) - ;; - let string_of_op = let pos = { OpamParserTypes.FullPos.filename = ""; start = 0, 0; stop = 0, 0 } in fun pelem -> OpamPrinter.FullPos.relop { pelem; pos } @@ -1208,9 +1208,8 @@ module Solver = struct (* Check for user-supplied restrictions *) let examine_extra_restrictions report = Role.Map.iteri report ~f:(fun role component -> - Model.user_restrictions role - |> Option.iter ~f:(fun restriction -> - Component.apply_user_restriction component restriction)) + Model.Role.user_restrictions role + |> Option.iter ~f:(Component.apply_user_restriction component)) ;; module Classes = Map.Make (struct