aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/dialyzer_common.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-07-04 14:12:07 +0200
committerMagnus Lång <[email protected]>2016-07-04 15:35:05 +0200
commit784f845e2d1ec66b9505339b4b0e43d55c2d49a9 (patch)
tree40ee492ba9ecc4efdbfdca696b46c759c714e01f /lib/dialyzer/test/dialyzer_common.erl
parent1697cdea341e7d54e754e5f85e091c8bb68fb6c7 (diff)
downloadotp-784f845e2d1ec66b9505339b4b0e43d55c2d49a9.tar.gz
otp-784f845e2d1ec66b9505339b4b0e43d55c2d49a9.tar.bz2
otp-784f845e2d1ec66b9505339b4b0e43d55c2d49a9.zip
dialyzer: Suppress warns on generated case stmts
Warnings about clauses that cannot match and are also compiler generated are suppressed unless none of the clauses return. This feature is useful for non-Erlang BEAM languages (such as Elixir) that compile to Erlang and expand certain language constructs into case statements. In that case, as long as the language construct can succeed, these warnings are undesired and appear spurious to users that do not check the Erlang code that their program expands into. Thanks to José Valim for the test (slightly modified).
Diffstat (limited to 'lib/dialyzer/test/dialyzer_common.erl')
-rw-r--r--lib/dialyzer/test/dialyzer_common.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/dialyzer/test/dialyzer_common.erl b/lib/dialyzer/test/dialyzer_common.erl
index d2b1026c06..48083a2731 100644
--- a/lib/dialyzer/test/dialyzer_common.erl
+++ b/lib/dialyzer/test/dialyzer_common.erl
@@ -7,7 +7,7 @@
-module(dialyzer_common).
--export([check_plt/1, check/4, create_all_suites/0, new_tests/2]).
+-export([check_plt/1, check/4, create_all_suites/0, new_tests/2, plt_file/1]).
-include_lib("kernel/include/file.hrl").
@@ -39,7 +39,7 @@
check_plt(OutDir) ->
io:format("Checking plt:"),
- PltFilename = filename:join(OutDir, ?plt_filename),
+ PltFilename = plt_file(OutDir),
case file:read_file_info(PltFilename) of
{ok, _} -> dialyzer_check_plt(PltFilename);
{error, _ } ->
@@ -63,6 +63,11 @@ check_plt(OutDir) ->
end
end.
+-spec plt_file(string()) -> string().
+
+plt_file(OutDir) ->
+ filename:join(OutDir, ?plt_filename).
+
dialyzer_check_plt(PltFilename) ->
try dialyzer:run([{analysis_type, plt_check},
{init_plt, PltFilename}]) of
@@ -119,7 +124,7 @@ build_plt(PltFilename) ->
'same' | {differ, [term()]}.
check(TestCase, Opts, Dir, OutDir) ->
- PltFilename = filename:join(OutDir, ?plt_filename),
+ PltFilename = plt_file(OutDir),
SrcDir = filename:join(Dir, ?input_files_directory),
ResDir = filename:join(Dir, ?result_files_directory),
Filename = filename:join(SrcDir, atom_to_list(TestCase)),