Skip to content

Opam constraints operator precedence is not honored. #3431

@mefyl

Description

@mefyl

A depends stanza such as the following one in the dune-project file will output a wrong OPAM constraint expression because logical operator precedence seems to be ignored.

  (alcotest
   (and
    (or :with-test :dev)
    (>= 1.1.0)))

Expected Behavior

"alcotest" { (with-test | dev) & >= "1.1.0"}

Actual Behavior

"alcotest" {with-test | dev & >= "1.1.0"}

Reproduction

dune build any project with a dune-project looking like

(lang dune 2.2)

(name coin)

(generate_opam_files true)

(package
 (name coin)
 (synopsis "COIN")
 (depends
  (alcotest
   (or
    (and (>= 1.1.0) :with-test)
    (and (>= 1.1.0) :dev))))

and look at the generated coin.opam.

Specifications

  • Version of dune: 2.5.1
  • Version of ocaml: 4.06.0
  • Operating system : Linux 5.4.28-gentoo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions