Skip to content

Commit

Permalink
Merge pull request #584 from rgrinberg/improve-error-modules
Browse files Browse the repository at this point in the history
Improve error in modules partition
  • Loading branch information
rgrinberg committed Mar 5, 2018
2 parents 3edc029 + 348d2b1 commit 5ded45f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/modules_partitioner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ let emit_warnings t =
Loc.warn loc
"Module %S is used in several stanzas:@\n\
@[<v>%a@]@\n\
This will become an error in the future."
@[%a@]@\n\
This warning will become an error in the future."
name
(Fmt.list (Fmt.prefix (Fmt.string "- ") Loc.pp_file_colon_line))
locs)
locs
Format.pp_print_text
"To remove this warning, you must specify an explicit \"modules\" \
field in every library, executable, and executables stanzas in \
this jbuild file. Note that each module cannot appear in more \
than one \"modules\" field - it must belong to a single library \
or executable.")
12 changes: 10 additions & 2 deletions test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
Warning: Module "Lib" is used in several stanzas:
- jbuild:8
- jbuild:4
This will become an error in the future.
To remove this warning, you must specify an explicit "modules" field in every
library, executable, and executables stanzas in this jbuild file. Note that
each module cannot appear in more than one "modules" field - it must belong
to a single library or executable.
This warning will become an error in the future.
Multiple rules generated for _build/default/lib.o:
- <internal location>
- <internal location>
Expand All @@ -14,7 +18,11 @@
Warning: Module "X" is used in several stanzas:
- src/jbuild:4
- src/jbuild:3
This will become an error in the future.
To remove this warning, you must specify an explicit "modules" field in every
library, executable, and executables stanzas in this jbuild file. Note that
each module cannot appear in more than one "modules" field - it must belong
to a single library or executable.
This warning will become an error in the future.
ocamldep src/x.ml.d
ocamlc src/.a.objs/a.{cmi,cmo,cmt}
ocamlc src/.a.objs/a__X.{cmi,cmo,cmt}
Expand Down

0 comments on commit 5ded45f

Please sign in to comment.