From 719cf5eea087412586290963b46d2e2b7fef9fd9 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 5 Mar 2018 17:35:18 +0700 Subject: [PATCH] Improve error in modules partition Specify how to fix the error (by writing modules fields) --- src/modules_partitioner.ml | 6 +++++- test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules_partitioner.ml b/src/modules_partitioner.ml index 25a9b19c..72dc7810 100644 --- a/src/modules_partitioner.ml +++ b/src/modules_partitioner.ml @@ -37,7 +37,11 @@ let emit_warnings t = Loc.warn loc "Module %S is used in several stanzas:@\n\ @[%a@]@\n\ - This will become an error in the future." + This will become an error in the future.@.\ + To fix this error, 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" name (Fmt.list (Fmt.prefix (Fmt.string "- ") Loc.pp_file_colon_line)) locs) diff --git a/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t b/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t index 3bb77ca5..8df918f8 100644 --- a/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t +++ b/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t @@ -4,6 +4,7 @@ - jbuild:8 - jbuild:4 This will become an error in the future. + To fix this error, 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 Multiple rules generated for _build/default/lib.o: - - @@ -15,6 +16,7 @@ - src/jbuild:4 - src/jbuild:3 This will become an error in the future. + To fix this error, 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 ocamldep src/x.ml.d ocamlc src/.a.objs/a.{cmi,cmo,cmt} ocamlc src/.a.objs/a__X.{cmi,cmo,cmt}