Skip to content

Commit

Permalink
Also load restriction from UserRestriction
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonidas-from-XIV committed Feb 3, 2022
1 parent eea6334 commit a0cf396
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/opam_solve.ml
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,17 @@ module Make_solver (Context : OPAM_MONOREPO_CONTEXT) :
let* pkg_name = Solver.package_name pkg in
let notes = Solver.Diagnostics.Component.notes component in
(* In the rejected candidates, try to find one where it had failed a version restriction and extract that one *)
let* version_restriction =
let* _, version_restriction =
List.find_map
~f:(function
| UserRequested restriction -> Some restriction
| Restricts (_other_role, _impl, restrictions) -> (
match restrictions with
| [] -> None
| restriction :: _ ->
let _, version_restriction =
Solver.formula restriction
in
Some version_restriction)
| restriction :: _ -> Some restriction)
| _ -> None)
notes
|> Option.map ~f:Solver.formula
in
let rejects, _reason =
Solver.Diagnostics.Component.rejects component
Expand Down

0 comments on commit a0cf396

Please sign in to comment.