aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-01-28 12:26:34 +0100
committerHans Bolinder <[email protected]>2014-01-28 12:26:34 +0100
commit9b4c2ce1049d668617579525d9beb3061061b8de (patch)
tree3cadb4e091a8fca0e1fbf779bed1eea4fb28b1f6 /lib
parentbb1d3d51651b5f2cd9d8c8b1e541c7e841aaab18 (diff)
parent29b974d60a76cfd5eb6a1b30b76905952e239d25 (diff)
downloadotp-9b4c2ce1049d668617579525d9beb3061061b8de.tar.gz
otp-9b4c2ce1049d668617579525d9beb3061061b8de.tar.bz2
otp-9b4c2ce1049d668617579525d9beb3061061b8de.zip
Merge branch 'nox/export_all-behaviour'
* nox/export_all-behaviour: Properly handle export_all when looking for undefined callbacks
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/erl_lint.erl13
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl10
2 files changed, 20 insertions, 3 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().
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index a71d7f3018..6e9a9dd7bf 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -2859,7 +2859,15 @@ behaviour_basic(Config) when is_list(Config) ->
stop(_) -> ok.
">>,
[],
- []}
+ []},
+
+ {behaviour4,
+ <<"-behavior(application). %% Test callbacks with export_all
+ -compile(export_all).
+ stop(_) -> ok.
+ ">>,
+ [],
+ {warnings,[{1,erl_lint,{undefined_behaviour_func,{start,2},application}}]}}
],
?line [] = run(Config, Ts),
ok.