summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinz N. Gies <heinz@licenser.net>2015-09-21 22:11:30 +0200
committerHeinz N. Gies <heinz@licenser.net>2015-09-21 22:11:30 +0200
commitf0812710e38dc1492faf3e141dd51ac7d2be6de4 (patch)
tree2e34d8da0fe17bbde47f737b8659349d142d0a52
parentffe84add6799e67e0b4f5fbca2b0b6f1da87d363 (diff)
Enable highlighting in contracts
-rw-r--r--src/rebar_dialyzer_format.erl16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/rebar_dialyzer_format.erl b/src/rebar_dialyzer_format.erl
index 5e84049..1f9e241 100644
--- a/src/rebar_dialyzer_format.erl
+++ b/src/rebar_dialyzer_format.erl
@@ -1,7 +1,6 @@
-module(rebar_dialyzer_format).
--export([format/1]).
-
+-export([format/1, bad_arg/2, seperate_args/1]).
-define(NR, "\033[0;31m").
-define(NG, "\033[0;32m").
@@ -353,11 +352,11 @@ call_or_apply_to_string(ArgNs, FailReason, SigArgs, SigRet,
case (ArgNs =:= []) orelse IsOverloaded of
true ->
%% We do not know which arguments caused the failure
- fmt("~!Wbreaks the contract~!! ~s\n", [Contract]);
+ fmt("~!Wbreaks the contract~!! ~s\n", [good_arg(ArgNs, Contract)]);
false ->
fmt("~!Wbreaks the contract~!! ~s ~!Win the~!!"
" ~s ~!Wargument\n",
- [good_arg(ArgNs, Contract), PositionString])
+ [good_arg(ArgNs, Contract), PositionString])
end;
both ->
fmt("~!Wwill never return since the success typing is "
@@ -439,10 +438,9 @@ good_arg(N, Args) ->
color_arg(N, C, Args) when is_integer(N) ->
color_arg([N], C, Args);
color_arg(Ns, C, Args) ->
- Args1 = seperate_args(Args),
+ {Args1, Rest} =seperate_args(Args),
Args2 = highlight(Ns, 1, C, Args1),
- join_args(Args2).
-
+ join_args(Args2) ++ Rest.
highlight([], _N, _C, Rest) ->
Rest;
@@ -469,8 +467,8 @@ seperate_args([], [$,, $\s | R], Arg, Args) ->
seperate_args([], [$, | R], Arg, Args) ->
seperate_args([], R, [], [lists:reverse(Arg) | Args]);
-seperate_args([], [$)], Arg, Args) ->
- lists:reverse([lists:reverse(Arg) | Args]);
+seperate_args([], [$) | Rest], Arg, Args) ->
+ {lists:reverse([lists:reverse(Arg) | Args]), Rest};
seperate_args([C | D], [C | R], Arg, Args) ->
seperate_args(D, R, [C | Arg], Args);
%% Brackets