Make variable rename errors more consistent

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-07-06 18:48:30 +07:00
parent c4545fce18
commit b8f11b1f04
2 changed files with 10 additions and 8 deletions

View File

@ -665,8 +665,8 @@ module Action = struct
| Pair ("findlib", s) when syntax_version >= (1, 0) -> | Pair ("findlib", s) when syntax_version >= (1, 0) ->
Loc.fail Loc.fail
loc loc
"The findlib special variable is not supported anymore, please use lib instead:\n\ "The findlib special variable is not supported in jbuild files, \
%%{lib:%s}" please use lib instead:\n%%{lib:%s} in dune files"
s s
| Pair ("findlib", s) | Pair ("findlib", s)
| Pair ("lib", s) -> begin | Pair ("lib", s) -> begin
@ -822,13 +822,14 @@ module Action = struct
if syntax_version < (1, 0) then if syntax_version < (1, 0) then
first_dep () first_dep ()
else 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 () | "first-dep" when syntax_version >= (1, 0) -> first_dep ()
| "^" -> | "^" ->
if syntax_version < (1, 0) then if syntax_version < (1, 0) then
Some (Value.L.paths deps_written_by_user) Some (Value.L.paths deps_written_by_user)
else 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) -> | "deps" when syntax_version >= (1, 0) ->
Some (Value.L.paths deps_written_by_user) Some (Value.L.paths deps_written_by_user)
| _ -> None) | _ -> None)
@ -842,8 +843,9 @@ module Action = struct
| [] -> () | [] -> ()
| x :: _ -> | x :: _ ->
let loc = String_with_vars.loc x in let loc = String_with_vars.loc x in
Loc.warn loc "Aliases must not have targets, this target will be ignored.\n\ Loc.warn loc
This will become an error in the future."; "Aliases must not have targets, this target will be ignored.\n\
This will become an error in the future.";
end; end;
let t, forms = let t, forms =
expand_step1 sctx t ~dir ~dep_kind ~scope expand_step1 sctx t ~dir ~dep_kind ~scope

View File

@ -3,8 +3,8 @@ We are dropping support for findlib in dune
$ dune build --root in-dune target.txt $ dune build --root in-dune target.txt
Entering directory 'in-dune' Entering directory 'in-dune'
File "dune", line 2, characters 25-37: File "dune", line 2, characters 25-37:
Error: The findlib special variable is not supported anymore, please use lib instead: Error: The findlib special variable is not supported in jbuild files, please use lib instead:
%{lib:pkg} %{lib:pkg} in dune files
[1] [1]
But it must still be available in jbuild files But it must still be available in jbuild files