Skip to content

Commit 2da8a3c

Browse files
committed
test: document transparent alias and library recompilation (#4572)
Add baseline test verifying that incremental builds succeed when a module re-exports a library via a transparent alias (module M = Mylib) and the library's interface changes. Regression reported by @Alizter. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
1 parent 0ad4949 commit 2da8a3c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Baseline: transparent module aliases and library dependency recompilation.
2+
3+
When a module re-exports a library via a transparent alias (module M = Mylib),
4+
consumers that use the alias must be recompiled when the library changes.
5+
6+
See: https://github.com/ocaml/dune/issues/4572
7+
8+
$ cat > dune-project <<EOF
9+
> (lang dune 3.0)
10+
> EOF
11+
12+
$ mkdir lib
13+
$ cat > lib/dune <<EOF
14+
> (library (name mylib))
15+
> EOF
16+
$ cat > lib/mylib.ml <<EOF
17+
> let v = 42
18+
> EOF
19+
$ cat > lib/mylib.mli <<EOF
20+
> val v : int
21+
> EOF
22+
23+
$ cat > dune <<EOF
24+
> (executable (name main) (libraries mylib))
25+
> EOF
26+
$ cat > re.ml <<EOF
27+
> module M = Mylib
28+
> EOF
29+
$ cat > re.mli <<EOF
30+
> module M = Mylib
31+
> EOF
32+
$ cat > main.ml <<EOF
33+
> let () = print_int Re.M.v
34+
> EOF
35+
36+
$ dune build ./main.exe
37+
38+
Change mylib's interface:
39+
40+
$ cat > lib/mylib.mli <<EOF
41+
> val v : int
42+
> val w : string
43+
> EOF
44+
$ cat > lib/mylib.ml <<EOF
45+
> let v = 42
46+
> let w = ""
47+
> EOF
48+
49+
The incremental build must succeed:
50+
51+
$ dune build ./main.exe

0 commit comments

Comments
 (0)