Skip to content

Commit

Permalink
fix: select with bigarray in OCaml 5 (#10011)
Browse files Browse the repository at this point in the history
This is related to #9981.

Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
  • Loading branch information
moyodiallo authored Mar 6, 2024
1 parent 633256c commit 9ee62e2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/changes/10011.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix conditional source selection with `select` on `bigarray` in OCaml 5
(#10011, @moyodiallo)
6 changes: 3 additions & 3 deletions src/dune_rules/lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,10 @@ end = struct

let available_internal db (name : Lib_name.t) =
let open Memo.O in
resolve_dep db (Loc.none, name) ~private_deps:Allow_all
find_internal db name
>>| function
| Some x -> Resolve.is_ok x
| None -> false
| Ignore | Found _ -> true
| Not_found | Invalid _ | Hidden _ -> false
;;

let resolve_simple_deps db names ~private_deps : t list Resolve.Memo.t =
Expand Down
3 changes: 3 additions & 0 deletions test/blackbox-tests/test-cases/bigarray.t/d/d.bigarray.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let _d = Bigarray.C_layout_typ

let () = Printf.eprintf "Welcome to d WITH bigarray support\n%!"
1 change: 1 addition & 0 deletions test/blackbox-tests/test-cases/bigarray.t/d/d.dummy.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let () = Printf.eprintf "Welcome to d with nothing inferred\n%!"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let () = Printf.eprintf "Welcome to d WITHOUT bigarray support\n%!"
9 changes: 9 additions & 0 deletions test/blackbox-tests/test-cases/bigarray.t/d/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(executable
(name d)
(libraries
(select
d.ml
from
(bigarray -> d.bigarray.ml)
(!bigarray -> d.nobigarray.ml)
(-> d.dummy.ml))))
3 changes: 3 additions & 0 deletions test/blackbox-tests/test-cases/bigarray.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ This test uses `(libraries (re_export bigarray))` similarly
This test uses a `(select )` construct and should always select bigarray support
$ dune exec c/c.exe
Welcome to c WITH bigarray support
This test uses a `(select )` construct and should always select bigarray supprot (the evaluation of `select` order differ from the previous test)
$ dune exec d/d.exe
Welcome to d WITH bigarray support

0 comments on commit 9ee62e2

Please sign in to comment.