summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-07-22 10:42:01 -0400
committerGitHub <noreply@github.com>2016-07-22 10:42:01 -0400
commitfef403b341a4c6bdf3626f00cc4c75ce268fa8c2 (patch)
tree6061983ec988651ecb850b8403e187374c6c0500
parent21571ad38a693124d2294db5c163eeae257f4280 (diff)
parent2c7296babf5849dba383b52894490e397acb64d2 (diff)
Merge pull request #1280 from ferd/fix-warning-opts
Fix opts check when compiler called with dict opts
-rw-r--r--src/rebar_base_compiler.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl
index 6b8c7ca..5d54057 100644
--- a/src/rebar_base_compiler.erl
+++ b/src/rebar_base_compiler.erl
@@ -155,7 +155,13 @@ format_warnings(Source, Warnings) ->
format_warnings(Source, Warnings, []).
format_warnings(Source, Warnings, Opts) ->
- Prefix = case lists:member(warnings_as_errors, Opts) of
+ %% `Opts' can be passed in both as a list or a dictionary depending
+ %% on whether the first call to rebar_erlc_compiler was done with
+ %% the type `rebar_dict()' or `rebar_state:t()'.
+ LookupFn = if is_list(Opts) -> fun lists:member/2
+ ; true -> fun dict:is_key/2
+ end,
+ Prefix = case LookupFn(warnings_as_errors, Opts) of
true -> "";
false -> "Warning: "
end,