Skip to content

Commit

Permalink
refactor(pkg): move Role.rejects (#11342)
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 7e2635c commit 0d0c7b6
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/dune_pkg/opam_solver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,22 @@ module Solver = struct

let pp = pp_role

let rejects role =
match role with
| Virtual _ -> Fiber.return ([], [])
| Real role ->
let+ rejects =
Context.candidates role.context role.name
>>| List.filter_map ~f:(function
| _, Ok _ -> None
| version, Error reason ->
let pkg = OpamPackage.create role.name version in
Some (Reject pkg, reason))
in
let notes = [] in
rejects, notes
;;

module Map = Map.Make (T)
end

Expand Down Expand Up @@ -519,22 +535,6 @@ module Solver = struct
| `Prevent -> not result)
;;

let rejects role =
match role with
| Virtual _ -> Fiber.return ([], [])
| Real role ->
let+ rejects =
Context.candidates role.context role.name
>>| List.filter_map ~f:(function
| _, Ok _ -> None
| version, Error reason ->
let pkg = OpamPackage.create role.name version in
Some (Reject pkg, reason))
in
let notes = [] in
rejects, notes
;;

let compare_version a b =
match a, b with
| RealImpl a, RealImpl b -> Ordering.of_int (OpamPackage.compare a.pkg b.pkg)
Expand Down Expand Up @@ -1227,7 +1227,7 @@ module Solver = struct
let diagnostics = lazy (explain role) in
let impl = if impl == Input.dummy_impl then None else Some impl in
let* impl_candidates = Input.implementations role in
let+ rejects, feed_problems = Input.rejects role in
let+ rejects, feed_problems = Input.Role.rejects role in
Component.create
~role
(impl_candidates, rejects, feed_problems)
Expand Down

0 comments on commit 0d0c7b6

Please sign in to comment.