diff --git a/src/lib.ml b/src/lib.ml index 0142797c..6eb0bffb 100644 --- a/src/lib.ml +++ b/src/lib.ml @@ -1147,11 +1147,10 @@ let report_lib_error ppf (e : Error.t) = Format.fprintf ppf "-> %S in %s" name (Path.to_string_maybe_quoted path))) cycle - | Private_deps_not_allowed (t : private_deps_not_allowed) -> + | Private_deps_not_allowed t -> Format.fprintf ppf - "%a@{Error@}: Library %S is private, it cannot be a dependency of\ + "@{Error@}: Library %S is private, it cannot be a dependency of \ a public library.\nYou need to give %S a public name.\n" - Loc.print t.pd_loc t.private_dep.name t.private_dep.name @@ -1167,6 +1166,8 @@ let () = | [] -> (* during bootstrap *) None | l -> Some (List.map l ~f:quote_for_shell |> String.concat ~sep:" ")) + | Private_deps_not_allowed t -> + (Some t.pd_loc, None) | _ -> (None, None) in Some diff --git a/test/blackbox-tests/test-cases/private-public-overlap/run.t b/test/blackbox-tests/test-cases/private-public-overlap/run.t index cf0acd4b..d1719a24 100644 --- a/test/blackbox-tests/test-cases/private-public-overlap/run.t +++ b/test/blackbox-tests/test-cases/private-public-overlap/run.t @@ -2,8 +2,8 @@ public libraries may not have private dependencies $ $JBUILDER build -j1 --display short --root private-dep 2>&1 | grep -v Entering File "jbuild", line 1, characters 0-155: - Error: Library "privatelib" is private, it cannot be a dependency ofa public library. You need to give "privatelib" a public name - -> required by library "publiclib" in _build/default + Error: Library "privatelib" is private, it cannot be a dependency of a public library. + You need to give "privatelib" a public name. ocamldep publiclib.ml.d On the other hand, public libraries may have private preprocessors @@ -23,8 +23,8 @@ On the other hand, public libraries may have private preprocessors Unless they introduce private runtime dependencies: $ $JBUILDER build -j1 --display short --root private-runtime-deps 2>&1 | grep -v Entering File "jbuild", line 8, characters 1-143: - Error: Library "private_runtime_dep" is private, it cannot be a dependency ofa public library. You need to give "private_runtime_dep" a public name - -> required by library "mylib" in _build/default + Error: Library "private_runtime_dep" is private, it cannot be a dependency of a public library. + You need to give "private_runtime_dep" a public name. ocamlc .private_ppx.objs/private_ppx.{cmi,cmo,cmt} ocamlopt .private_ppx.objs/private_ppx.{cmx,o} ocamlopt private_ppx.{a,cmxa}