My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Detect conflicting constraints in solve_internal

When the target package has the same name as an existing constraint
(e.g. solving ocaml-variants.5.4.1+options while --ocaml-version
pins ocaml-variants to 5.2.0+ox), return an error immediately
instead of silently overwriting the constraint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+11
+11
day11/solver/solve.ml
··· 5 5 ?(prefer_oldest = false) target = 6 6 let name = OpamPackage.name target in 7 7 let version = OpamPackage.version target in 8 + (* Don't overwrite an existing constraint — e.g. the compiler 9 + version pin from --ocaml-version should not be clobbered 10 + when the target happens to be a compiler package *) 11 + match OpamPackage.Name.Map.find_opt name constraints with 12 + | Some (`Eq, existing) when not (OpamPackage.Version.equal existing version) -> 13 + let msg = Printf.sprintf "Target %s conflicts with constraint %s = %s" 14 + (OpamPackage.to_string target) 15 + (OpamPackage.Name.to_string name) 16 + (OpamPackage.Version.to_string existing) in 17 + Error (msg, OpamPackage.Name.Set.empty) 18 + | _ -> 8 19 let constraints = 9 20 OpamPackage.Name.Map.add name (`Eq, version) constraints 10 21 in