summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Henoch <magnus.henoch@gmail.com>2012-07-09 11:40:21 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-10-22 22:10:26 +0200
commite8169e91e4a609f0c4a0ad3ff839773d39aa07be (patch)
treeaf635a3428062e7c5268b187c6010839115c0cbd
parent53ae245725f6e01113876eee61c8ae7abb8d9bf5 (diff)
Fix rebar_base_compiler:format_errors/3 for errors in include files
Handle the case where the error didn't occur in the file being compiled. That is, if there is an error on line 9 of bar.hrl, instead of: /path/to/foo.erl:9: type foo() already defined print: /path/to/bar.hrl:9: type foo() already defined
-rw-r--r--src/rebar_base_compiler.erl20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl
index e83a7aa..63e408b 100644
--- a/src/rebar_base_compiler.erl
+++ b/src/rebar_base_compiler.erl
@@ -235,15 +235,17 @@ maybe_report(_) ->
report(Messages) ->
lists:foreach(fun(Msg) -> io:format("~s", [Msg]) end, Messages).
-format_errors(Config, Source, Extra, Errors) ->
- AbsSource = case rebar_utils:processing_base_dir(Config) of
- true ->
- Source;
- false ->
- filename:absname(Source)
- end,
- [[format_error(AbsSource, Extra, Desc) || Desc <- Descs]
- || {_, Descs} <- Errors].
+format_errors(Config, _MainSource, Extra, Errors) ->
+ [begin
+ AbsSource = case rebar_utils:processing_base_dir(Config) of
+ true ->
+ Source;
+ false ->
+ filename:absname(Source)
+ end,
+ [format_error(AbsSource, Extra, Desc) || Desc <- Descs]
+ end
+ || {Source, Descs} <- Errors].
format_error(AbsSource, Extra, {{Line, Column}, Mod, Desc}) ->
ErrorDesc = Mod:format_error(Desc),