aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/erl_lint.erl
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-10-12 13:43:38 +0200
committerHenrik Nord <[email protected]>2014-01-23 10:24:43 +0100
commit29b974d60a76cfd5eb6a1b30b76905952e239d25 (patch)
tree7217f1ee167fce97b04cf34ace28757cad8bad33 /lib/stdlib/src/erl_lint.erl
parente99633a51cbd22b16606c2669c575c22cf1c511f (diff)
downloadotp-29b974d60a76cfd5eb6a1b30b76905952e239d25.tar.gz
otp-29b974d60a76cfd5eb6a1b30b76905952e239d25.tar.bz2
otp-29b974d60a76cfd5eb6a1b30b76905952e239d25.zip
Properly handle export_all when looking for undefined callbacks
Reported-by: Michele Miron
Diffstat (limited to 'lib/stdlib/src/erl_lint.erl')
-rw-r--r--lib/stdlib/src/erl_lint.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index cf01e1f8cf..f0d50df4c7 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -844,8 +844,9 @@ behaviour_callbacks(Line, B, St0) ->
{[], St1}
end.
-behaviour_missing_callbacks([{{Line,B},Bfs}|T], #lint{exports=Exp}=St0) ->
- Missing = ordsets:subtract(ordsets:from_list(Bfs), gb_sets:to_list(Exp)),
+behaviour_missing_callbacks([{{Line,B},Bfs}|T], St0) ->
+ Exports = gb_sets:to_list(exports(St0)),
+ Missing = ordsets:subtract(ordsets:from_list(Bfs), Exports),
St = foldl(fun (F, S0) ->
add_warning(Line, {undefined_behaviour_func,F,B}, S0)
end, St0, Missing),
@@ -1149,6 +1150,14 @@ export_type(Line, ETs, #lint{usage = Usage, exp_types = ETs0} = St0) ->
add_error(Line, {bad_export_type, ETs}, St0)
end.
+-spec exports(lint_state()) -> gb_set().
+
+exports(#lint{compile = Opts, defined = Defs, exports = Es}) ->
+ case lists:member(export_all, Opts) of
+ true -> Defs;
+ false -> Es
+ end.
+
-type import() :: {module(), [fa()]} | module().
-spec import(line(), import(), lint_state()) -> lint_state().