Use the use-site location for errors from pps
This commit is contained in:
parent
7e361d596e
commit
e57a706960
13
src/lib.ml
13
src/lib.ml
|
@ -790,7 +790,12 @@ and resolve_user_deps db deps ~allow_private_deps ~pps ~stack =
|
|||
let deps, pps =
|
||||
match pps with
|
||||
| [] -> (deps, Ok [])
|
||||
| pps ->
|
||||
| first :: others as pps ->
|
||||
(* Location of the list of ppx rewriters *)
|
||||
let loc =
|
||||
let last = Option.value (List.last others) ~default:first in
|
||||
{ (fst first) with stop = (fst last).stop }
|
||||
in
|
||||
let pps =
|
||||
let pps = (pps : (Loc.t * Jbuild.Pp.t) list :> (Loc.t * string) list) in
|
||||
resolve_simple_deps db pps ~allow_private_deps:true ~stack
|
||||
|
@ -798,16 +803,16 @@ and resolve_user_deps db deps ~allow_private_deps ~pps ~stack =
|
|||
closure_with_overlap_checks None pps ~stack
|
||||
in
|
||||
let deps =
|
||||
let rec check_runtime_deps acc pps ~loc = function
|
||||
let rec check_runtime_deps acc pps = function
|
||||
| [] -> loop acc pps
|
||||
| lib :: ppx_rts ->
|
||||
check_private_deps ~lib ~loc ~allow_private_deps >>= fun rt ->
|
||||
check_runtime_deps (rt :: acc) pps ~loc ppx_rts
|
||||
check_runtime_deps (rt :: acc) pps ppx_rts
|
||||
and loop acc = function
|
||||
| [] -> Ok acc
|
||||
| pp :: pps ->
|
||||
pp.ppx_runtime_deps >>= fun rt_deps ->
|
||||
check_runtime_deps acc pps ~loc:pp.loc rt_deps
|
||||
check_runtime_deps acc pps rt_deps
|
||||
in
|
||||
deps >>= fun deps ->
|
||||
pps >>= fun pps ->
|
||||
|
|
|
@ -22,7 +22,7 @@ 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:
|
||||
File "jbuild", line 1, characters 0-327:
|
||||
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}
|
||||
|
|
Loading…
Reference in New Issue