dune icon indicating copy to clipboard operation
dune copied to clipboard

Possible regression in the `select` stanza

Open vsiles opened this issue 3 years ago • 14 comments

Expected Behavior

In dune lang 1.X, we are able to access files in subdirectories using select (like in https://github.com/facebook/hhvm/blob/master/hphp/hack/src/errors/dune#L16)

Actual Behavior

We are trying to move to dune lang 2.9 and this now raise an error:

Error: The format for files in this select branch must be a.{name}.ml

Reproduction

Here is a small POC that shows the error:

$ tree
.
├── a.stubs.ml
├── dune
├── dune-project
├── foo
│   └── a.foo.ml
└── xxx.ml
$ cat dune
(library
    (name a)
    (modules )
    (libraries
     (select a.ml from
      (foo -> foo/a.foo.ml)
      (-> a.stubs.ml)
    )
    )
)

(executable
    (name xxx)
    (modules xxx)
    (libraries a)
)
$ dune clean && dune build xxx.exe
File "dune", line 6, characters 14-26:
6 |       (foo -> foo/a.foo.ml)
                  ^^^^^^^^^^^^
Error: The format for files in this select branch must be a.{name}.ml

Specifications

$ dune --version
2.9.1
$ cat dune-project
(lang dune 2.9)
$ ocaml -version

Both on macos and linux (centos), everything installed normally via opam

Additional information

We're use to have a select that look like

    (select error_message_sentinel.ml from
      (facebook -> facebook/error_message_sentinel.ml)
      (-> error_message_sentinel.stubs.ml))))

where the facebook one doesn't have a special extension (because of our internal build too being not dune). If that could stay like that, it would be really great

vsiles avatar Nov 05 '21 15:11 vsiles