Improve error messages for all forms
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
813b8d9dbc
commit
7cb068d1eb
16
src/var.ml
16
src/var.ml
|
@ -151,7 +151,12 @@ module Map = struct
|
||||||
let name = String_with_vars.Var.name var in
|
let name = String_with_vars.Var.name var in
|
||||||
Option.bind (String.Map.find t name) ~f:(fun v ->
|
Option.bind (String.Map.find t name) ~f:(fun v ->
|
||||||
let what var =
|
let what var =
|
||||||
sprintf "Variable %s" (String_with_vars.Var.to_string var) in
|
String_with_vars.Var.to_string (
|
||||||
|
if String_with_vars.Var.is_form var then
|
||||||
|
String_with_vars.Var.with_payload var ~payload:(Some "..")
|
||||||
|
else
|
||||||
|
var)
|
||||||
|
in
|
||||||
match v with
|
match v with
|
||||||
| No_info v -> Some v
|
| No_info v -> Some v
|
||||||
| Since (v, min_version) ->
|
| Since (v, min_version) ->
|
||||||
|
@ -163,17 +168,10 @@ module Map = struct
|
||||||
~what:(what var)
|
~what:(what var)
|
||||||
| Renamed_in (in_version, new_name) -> begin
|
| Renamed_in (in_version, new_name) -> begin
|
||||||
if syntax_version >= in_version then
|
if syntax_version >= in_version then
|
||||||
let var =
|
|
||||||
if String_with_vars.Var.is_form var then
|
|
||||||
String_with_vars.Var.with_payload var ~payload:(Some "..")
|
|
||||||
else
|
|
||||||
var
|
|
||||||
in
|
|
||||||
Syntax.Error.renamed_in (String_with_vars.Var.loc var)
|
Syntax.Error.renamed_in (String_with_vars.Var.loc var)
|
||||||
Stanza.syntax syntax_version
|
Stanza.syntax syntax_version
|
||||||
~what:(what var)
|
~what:(what var)
|
||||||
~to_:(let open String_with_vars.Var in
|
~to_:(what (String_with_vars.Var.with_name var ~name:new_name))
|
||||||
to_string (with_name var ~name:new_name))
|
|
||||||
else
|
else
|
||||||
expand t ~syntax_version:in_version
|
expand t ~syntax_version:in_version
|
||||||
~var:(String_with_vars.Var.with_name var ~name:new_name)
|
~var:(String_with_vars.Var.with_name var ~name:new_name)
|
||||||
|
|
|
@ -6,7 +6,7 @@ All builtin variables are lower cased in Dune:
|
||||||
$ dune runtest --root dune-upper
|
$ dune runtest --root dune-upper
|
||||||
Entering directory 'dune-upper'
|
Entering directory 'dune-upper'
|
||||||
File "dune", line 3, characters 41-46:
|
File "dune", line 3, characters 41-46:
|
||||||
Error: Variable %{MAKE} was renamed to '%{make}' in the 1.0 version of the dune language
|
Error: %{MAKE} was renamed to '%{make}' in the 1.0 version of the dune language
|
||||||
[1]
|
[1]
|
||||||
|
|
||||||
jbuild files retain the the old names:
|
jbuild files retain the the old names:
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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: Variable %{findlib:..} was renamed to '%{lib:..}' in the 1.0 version of the dune language
|
Error: %{findlib:..} was renamed to '%{lib:..}' in the 1.0 version of the dune language
|
||||||
[1]
|
[1]
|
||||||
|
|
||||||
But it must still be available in jbuild files
|
But it must still be available in jbuild files
|
||||||
|
|
|
@ -9,7 +9,7 @@ In expands to a file name, and registers this as a dependency.
|
||||||
$ dune build --root dune @test-dep
|
$ dune build --root dune @test-dep
|
||||||
Entering directory 'dune'
|
Entering directory 'dune'
|
||||||
File "dune", line 13, characters 17-47:
|
File "dune", line 13, characters 17-47:
|
||||||
Error: Variable %{path:..} was renamed to '%{dep:..}' in the 1.0 version of the dune language
|
Error: %{path:..} was renamed to '%{dep:..}' in the 1.0 version of the dune language
|
||||||
[1]
|
[1]
|
||||||
|
|
||||||
%{path-no-dep:string}
|
%{path-no-dep:string}
|
||||||
|
@ -20,7 +20,7 @@ This form does not exist, but displays an hint:
|
||||||
$ dune build --root dune-invalid @test-path-no-dep
|
$ dune build --root dune-invalid @test-path-no-dep
|
||||||
Entering directory 'dune-invalid'
|
Entering directory 'dune-invalid'
|
||||||
File "dune", line 7, characters 17-54:
|
File "dune", line 7, characters 17-54:
|
||||||
Error: Variable %{path-no-dep:file-that-does-not-exist} was deleted in version 1.0 of the dune language
|
Error: %{path-no-dep:..} was deleted in version 1.0 of the dune language
|
||||||
[1]
|
[1]
|
||||||
|
|
||||||
jbuild files
|
jbuild files
|
||||||
|
@ -53,5 +53,5 @@ This form does not exist, but displays an hint:
|
||||||
$ dune build --root jbuild-invalid @test-dep
|
$ dune build --root jbuild-invalid @test-dep
|
||||||
Entering directory 'jbuild-invalid'
|
Entering directory 'jbuild-invalid'
|
||||||
File "jbuild", line 5, characters 16-37:
|
File "jbuild", line 5, characters 16-37:
|
||||||
Error: Variable ${dep:generated-file} is only available since version 1.0 of the dune language
|
Error: ${dep:..} is only available since version 1.0 of the dune language
|
||||||
[1]
|
[1]
|
||||||
|
|
Loading…
Reference in New Issue