Open reynir opened 2 weeks ago
Alternatively, I would expect a warning about the redundant version constraint.
Yet another alternative could be to make dune init
emit a dune-project
where package (depends ...)
does not contain dune
as it seems to get automagically emitted anyway in the resulting opam file!
Personally I agree that dune init
should not emit a dune-project which contains dune
; this has caused some issues already, so maybe that's the "simple" way out.
The reason why the constraint is duplicated is that if there is some constraint then dune
will merge this constraint and also add the (>= dune-lang-version)
constraint instead of throwing out the users constraint or throwing out dune's automatically added constraint.
The issue you run into is that your constraint is asking for 3.16.0
, while the constraint that is added is 3.16
thus they are technically not equal (I think 3.16.0~alpha0
would satisfy one but not the other). There might be a valid case for requiring dune >= N+1
despite dune-lang N
which will generate { dune >= N & dune >= N+1 }
. We could attempt to merge them into the highest version but I worry that this might become quite tricky and unintuitive as the user-supplied constraints can potentially be complex.
Expected Behavior
In
dune-project
I have aThis generates an opam file with
Actual Behavior
The generated opam file contains duplicate version constraints:
Reproduction
https://github.com/robur-coop/mirage-swapfs/commit/f9e946b3d82c13cdba9979b3d212224a65815219
Specifications
dune
(output ofdune --version
): 3.16.0ocaml
(output ofocamlc --version
): 4.14.2