From b8f11b1f0409be9fe6885c2e59e92801e01a139b Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 6 Jul 2018 18:48:30 +0700 Subject: [PATCH] Make variable rename errors more consistent Signed-off-by: Rudi Grinberg --- src/super_context.ml | 14 ++++++++------ test/blackbox-tests/test-cases/findlib-error/run.t | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/super_context.ml b/src/super_context.ml index 6a6a49cc..fef59a01 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -665,8 +665,8 @@ module Action = struct | Pair ("findlib", s) when syntax_version >= (1, 0) -> Loc.fail loc - "The findlib special variable is not supported anymore, please use lib instead:\n\ - %%{lib:%s}" + "The findlib special variable is not supported in jbuild files, \ + please use lib instead:\n%%{lib:%s} in dune files" s | Pair ("findlib", s) | Pair ("lib", s) -> begin @@ -822,13 +822,14 @@ module Action = struct if syntax_version < (1, 0) then first_dep () else - Loc.fail loc "Variable '<' is renamed to 'first-dep' in dune" + Loc.fail loc "Variable '<' is renamed to 'first-dep' in dune files" | "first-dep" when syntax_version >= (1, 0) -> first_dep () | "^" -> if syntax_version < (1, 0) then Some (Value.L.paths deps_written_by_user) else - Loc.fail loc "Variable %%{^} has been renamed to %%{deps}" + Loc.fail loc + "Variable %%{^} has been renamed to %%{deps} in dune files" | "deps" when syntax_version >= (1, 0) -> Some (Value.L.paths deps_written_by_user) | _ -> None) @@ -842,8 +843,9 @@ module Action = struct | [] -> () | x :: _ -> let loc = String_with_vars.loc x in - Loc.warn loc "Aliases must not have targets, this target will be ignored.\n\ - This will become an error in the future."; + Loc.warn loc + "Aliases must not have targets, this target will be ignored.\n\ + This will become an error in the future."; end; let t, forms = expand_step1 sctx t ~dir ~dep_kind ~scope diff --git a/test/blackbox-tests/test-cases/findlib-error/run.t b/test/blackbox-tests/test-cases/findlib-error/run.t index a46f6196..e704b5ba 100644 --- a/test/blackbox-tests/test-cases/findlib-error/run.t +++ b/test/blackbox-tests/test-cases/findlib-error/run.t @@ -3,8 +3,8 @@ We are dropping support for findlib in dune $ dune build --root in-dune target.txt Entering directory 'in-dune' File "dune", line 2, characters 25-37: - Error: The findlib special variable is not supported anymore, please use lib instead: - %{lib:pkg} + Error: The findlib special variable is not supported in jbuild files, please use lib instead: + %{lib:pkg} in dune files [1] But it must still be available in jbuild files