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,31 @@
We shouldn't allow foo/y/$x.ml to depend on foo/foo.ml
$ cat > dune-project << EOF
> (lang dune 3.7)
> EOF
$ cat > dune << EOF
> (include_subdirs qualified)
> (library
> (name foo))
> EOF
$ mkdir -p x/y
$ touch x/x.ml
$ cat >x/y/z.ml <<EOF
> let () = X.f
> EOF
$ dune build
Error: Module Z in directory _build/default depends on X.
This doesn't make sense to me.
X is the main module of the library and is the only module exposed outside of
the library. Consequently, it should be the one depending on all the other
modules in the library.
-> required by _build/default/.foo.objs/foo__X__Y__Z.impl.all-deps
-> required by _build/default/.foo.objs/byte/foo__X__Y__Z.cmo
-> required by _build/default/foo.cma
-> required by alias all
-> required by alias default
[1]

View file

@ -0,0 +1,31 @@
We shouldn't allow foo/$x.ml to depend on foo/foo.ml
$ cat > dune-project << EOF
> (lang dune 3.7)
> EOF
$ cat > dune << EOF
> (include_subdirs qualified)
> (library
> (name foo))
> EOF
$ mkdir baz
$ touch baz/baz.ml
$ cat >baz/bar.ml <<EOF
> let () = Baz.f
> EOF
$ dune build
Error: Module Bar in directory _build/default depends on Baz.
This doesn't make sense to me.
Baz is the main module of the library and is the only module exposed outside
of the library. Consequently, it should be the one depending on all the other
modules in the library.
-> required by _build/default/.foo.objs/foo__Baz__Bar.impl.all-deps
-> required by _build/default/.foo.objs/byte/foo__Baz__Bar.cmo
-> required by _build/default/foo.cma
-> required by alias all
-> required by alias default
[1]

View file

@ -0,0 +1,24 @@
We should forbid lib interfaces modules from depending on themselves:
$ cat > dune-project << EOF
> (lang dune 3.7)
> EOF
$ cat > dune << EOF
> (include_subdirs qualified)
> (library
> (name foo))
> EOF
$ cat > foo.ml <<EOF
> let () = Foo.f ()
> EOF
$ touch bar.ml
$ dune build @check
File "foo.ml", line 1, characters 9-14:
1 | let () = Foo.f ()
^^^^^
Error: Unbound module Foo
[1]