File tree 6 files changed +29
-18
lines changed
test/blackbox-tests/test-cases/pkg 6 files changed +29
-18
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ open Import
2
2
3
3
type t = OpamTypes .filtered_formula
4
4
5
- let of_dependencies deps = Package_dependency. list_to_opam_filtered_formula deps
5
+ let of_dependencies deps =
6
+ List. map deps ~f: Package_dependency. to_opam_filtered_formula |> OpamFormula. ands
7
+ ;;
8
+
6
9
let to_filtered_formula v = v
7
10
let of_filtered_formula v = v
8
11
let to_dyn = Opam_dyn. filtered_formula
Original file line number Diff line number Diff line change @@ -65,11 +65,13 @@ module For_solver = struct
65
65
|> OpamFile.OPAM. with_name (Package_name. to_opam_package_name name)
66
66
|> OpamFile.OPAM. with_depends (Dependency_formula. to_filtered_formula dependencies)
67
67
|> OpamFile.OPAM. with_conflicts
68
- (Package_dependency. list_to_opam_filtered_formula conflicts)
68
+ (List. map conflicts ~f: Package_dependency. to_opam_filtered_formula
69
+ |> OpamFormula. ors)
69
70
|> OpamFile.OPAM. with_conflict_class
70
71
(List. map conflict_class ~f: Package_name. to_opam_package_name)
71
72
|> OpamFile.OPAM. with_depopts
72
- (Package_dependency. list_to_opam_filtered_formula depopts)
73
+ (List. map depopts ~f: Package_dependency. to_opam_filtered_formula
74
+ |> OpamFormula. ands)
73
75
;;
74
76
75
77
let non_local_dependencies local_deps =
Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ module Context = struct
109
109
List. map constraints ~f: (fun (constraint_ : Package_dependency.t ) ->
110
110
constraint_.name, constraint_)
111
111
|> Package_name.Map. of_list_multi
112
- |> Package_name.Map. map ~f: Package_dependency. list_to_opam_filtered_formula
112
+ |> Package_name.Map. map ~f: (fun formulae ->
113
+ List. map formulae ~f: Package_dependency. to_opam_filtered_formula
114
+ |> OpamFormula. ands)
113
115
in
114
116
let available_cache =
115
117
Table. create
Original file line number Diff line number Diff line change @@ -210,16 +210,14 @@ let opam_depend { name; constraint_ } =
210
210
| Some c -> nopos (OpamParserTypes.FullPos. Option (pkg, nopos [ c ]))
211
211
;;
212
212
213
- let list_to_opam_filtered_formula ts =
214
- List. map ts ~f: (fun { name; constraint_ } ->
215
- let opam_package_name = Package_name. to_opam_package_name name in
216
- let condition =
217
- match constraint_ with
218
- | None -> OpamTypes. Empty
219
- | Some constraint_ -> Constraint. to_opam_condition constraint_
220
- in
221
- OpamFormula. Atom (opam_package_name, condition))
222
- |> OpamFormula. ands
213
+ let to_opam_filtered_formula { name; constraint_ } =
214
+ let opam_package_name = Package_name. to_opam_package_name name in
215
+ let condition =
216
+ match constraint_ with
217
+ | None -> OpamTypes. Empty
218
+ | Some constraint_ -> Constraint. to_opam_condition constraint_
219
+ in
220
+ OpamFormula. Atom (opam_package_name, condition)
223
221
;;
224
222
225
223
let list_of_opam_filtered_formula loc kind filtered_formula =
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ type t = Dune_lang.Package_dependency.t =
25
25
include module type of Dune_lang. Package_dependency with type t := t
26
26
27
27
val opam_depend : t -> OpamParserTypes.FullPos .value
28
- val list_to_opam_filtered_formula : t list -> OpamTypes .filtered_formula
28
+ val to_opam_filtered_formula : t -> OpamTypes .filtered_formula
29
29
30
30
(* * Attempt to interpret a [OpamTypes.filtered_formula] as a list of [t]s by
31
31
treating the formula as a conjunction of packages with constraints. *)
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ A package which depends on a single package and also conflicts with the same pac
22
22
bar. 0. 0. 1: Package does not satisfy constraints of local package foo
23
23
[1 ]
24
24
25
- Now add an additional conflict on a non-existant package " baz" . Dune will choose the package " bar " despite it being a conflict:
25
+ Now add an additional conflict on a non-existant package " baz" . Dune should continue to fail to find a solution due to the conflict with " bar " .
26
26
$ solve_project << EOF
27
27
> (lang dune 3.11 )
28
28
> (package
@@ -31,6 +31,12 @@ Now add an additional conflict on a non-existant package "baz". Dune will choose
31
31
> (depends bar)
32
32
> (conflicts bar baz))
33
33
> EOF
34
- Solution for dune. lock:
35
- - bar. 0. 0. 1
34
+ Error: Unable to solve dependencies for the following lock directories:
35
+ Lock directory dune. lock:
36
+ Couldn't solve the package dependency formula.
37
+ Selected candidates: foo. dev
38
+ - bar -> (problem)
39
+ No usable implementations:
40
+ bar. 0. 0. 1: Package does not satisfy constraints of local package foo
41
+ [1 ]
36
42
You can’t perform that action at this time.
0 commit comments