This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,2 @@
(library
(name foo))

View file

@ -0,0 +1 @@
(lang dune 1.0)

View file

@ -0,0 +1,11 @@
Errors:
$ dune build foo.cma
File "dune", lines 1-2, characters 0-21:
1 | (library
2 | (name foo))
Error: Some modules don't have an implementation.
You need to add the following field to this stanza:
(modules_without_implementation x y)
[1]

View file

@ -0,0 +1 @@
type t = int

View file

@ -0,0 +1 @@
type t = int

View file

@ -0,0 +1,3 @@
(library
(name foo)
(modules_without_implementation x))

View file

@ -0,0 +1 @@
(lang dune 1.0)

View file

@ -0,0 +1,10 @@
Error:
$ dune build foo.cma
File "dune", line 3, characters 33-34:
3 | (modules_without_implementation x))
^
Error: The following modules must be listed here as they don't have an
implementation:
- Y
[1]

View file

@ -0,0 +1,2 @@
type t = int

View file

@ -0,0 +1 @@
type t = int

View file

@ -0,0 +1,3 @@
(library
(name foo)
(modules_without_implementation x))

View file

@ -0,0 +1 @@
(lang dune 1.0)

View file

@ -0,0 +1,8 @@
Error:
$ dune build foo.cma
File "dune", line 3, characters 33-34:
3 | (modules_without_implementation x))
^
Error: Module X doesn't exist.
[1]

View file

@ -0,0 +1,3 @@
(library
(name foo)
(modules_without_implementation x))

View file

@ -0,0 +1 @@
(lang dune 1.0)

View file

@ -0,0 +1,10 @@
Error:
$ dune build foo.cma
File "dune", line 3, characters 33-34:
3 | (modules_without_implementation x))
^
Error: The following modules have an implementation, they cannot be listed as
modules_without_implementation:
- X
[1]

View file

@ -0,0 +1 @@
let x = 42

View file

@ -0,0 +1 @@
val x : int

View file

@ -0,0 +1,68 @@
Specifying a module without implementation that isn't inside the (modules ..)
field
$ cat > dune-project << EOF
> (lang dune 3.7)
> EOF
$ mkdir src
$ cat > src/dune << EOF
> (library
> (name foo)
> (wrapped false)
> (modules_without_implementation x)
> (modules y))
> EOF
$ touch src/x.mli
$ cat > src/y.ml << EOF
> module type F = X
> EOF
X is warned about:
$ dune build
File "src/dune", line 4, characters 33-34:
4 | (modules_without_implementation x)
^
Warning: These modules appear in the modules_without_implementation field:
- X
They must also appear in the modules field.
File "src/y.ml", line 1, characters 16-17:
1 | module type F = X
^
Error: Unbound module type X
[1]
In 3.11 onwards this warning becomes an error
$ cat > dune-project << EOF
> (lang dune 3.11)
> EOF
$ dune build
File "src/dune", line 4, characters 33-34:
4 | (modules_without_implementation x)
^
Error: These modules appear in the modules_without_implementation field:
- X
They must also appear in the modules field.
[1]
This should be ignored if we are in vendored_dirs
$ cat > dune << EOF
> (vendored_dirs src)
> (executable
> (name bar)
> (libraries foo))
> EOF
$ cat > bar.ml
$ dune build ./bar.exe
File "src/y.ml", line 1, characters 16-17:
1 | module type F = X
^
Error: Unbound module type X
[1]

View file

@ -0,0 +1,4 @@
(library
(name foo)
(public_name foo)
(modules_without_implementation intf))

View file

@ -0,0 +1 @@
module T = Intf

View file

@ -0,0 +1 @@
type t = A | B | C

View file

@ -0,0 +1,4 @@
Successes:
$ dune build --display short --debug-dep 2>*1 | grep -i cma
[1]

View file

@ -0,0 +1,5 @@
module X = Foo.T
let x = X.A
include Foo.T

View file

@ -0,0 +1,4 @@
(library
(name bar)
(public_name foo.bar)
(libraries foo))