Skip to content

Commit

Permalink
Improve error_info() type
Browse files Browse the repository at this point in the history
`erlfmt_scan` returns `erl_anno:location()` in errors however
`erlfmt_parse` mostly returns full `erlfmt_scan:anno()` maps. The errors
from the parser also surface in the return value of
`erlfmt:read_nodes[_string]`
  • Loading branch information
gomoripeti committed Dec 21, 2023
1 parent 732d443 commit 706128f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/erlfmt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@

-export_type([error_info/0, config_option/0, config/0, pragma/0]).

-type error_info() :: {file:name_all(), erl_anno:location(), module(), Reason :: any()}.
-type error_info() :: {
file:name_all(), erl_anno:location() | erlfmt_scan:anno(), module(), Reason :: any()
}.
-type pragma() :: require | insert | delete | ignore.
-type config_option() :: {pragma, pragma()} | {print_width, pos_integer()} | verbose.
-type config() :: [config_option()].
Expand Down
2 changes: 1 addition & 1 deletion src/erlfmt_parse.yrl
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ Erlang code.

%% XXX. To be refined.
-type error_description() :: term().
-type error_info() :: {erl_anno:line(), module(), error_description()}.
-type error_info() :: {erl_anno:location() | erlfmt_scan:anno(), module(), error_description()}.
-type token() :: erlfmt_scan:token().

%% mkop(Op, Arg) -> {op,Anno,Op,Arg}.
Expand Down

0 comments on commit 706128f

Please sign in to comment.