aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/plt_SUITE.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-11-10 15:00:33 +0100
committerHans Bolinder <[email protected]>2017-11-10 16:36:02 +0100
commitffd24a6d63b94c8871dc718204bc2cf805ceba73 (patch)
tree5fd0682ddbff59be0072f998570ee75798014ae1 /lib/dialyzer/test/plt_SUITE.erl
parent3a7743aba0260f98d00ca3ea9176a23efe8197d5 (diff)
downloadotp-ffd24a6d63b94c8871dc718204bc2cf805ceba73.tar.gz
otp-ffd24a6d63b94c8871dc718204bc2cf805ceba73.tar.bz2
otp-ffd24a6d63b94c8871dc718204bc2cf805ceba73.zip
dialyzer: Display error messages without call stack
As of commit 12b379 many of the reasons displayed after "Analysis failed with error:" erroneously include a call stack. The bug is now corrected. The bug was pointed out in http://erlang.org/pipermail/erlang-questions/2017-October/093838.html.
Diffstat (limited to 'lib/dialyzer/test/plt_SUITE.erl')
-rw-r--r--lib/dialyzer/test/plt_SUITE.erl30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/dialyzer/test/plt_SUITE.erl b/lib/dialyzer/test/plt_SUITE.erl
index ebe79b2a6d..a8a9f176fc 100644
--- a/lib/dialyzer/test/plt_SUITE.erl
+++ b/lib/dialyzer/test/plt_SUITE.erl
@@ -9,14 +9,14 @@
-export([suite/0, all/0, build_plt/1, beam_tests/1, update_plt/1,
local_fun_same_as_callback/1,
remove_plt/1, run_plt_check/1, run_succ_typings/1,
- bad_dialyzer_attr/1, merge_plts/1]).
+ bad_dialyzer_attr/1, merge_plts/1, bad_record_type/1]).
suite() ->
[{timetrap, ?plt_timeout}].
all() -> [build_plt, beam_tests, update_plt, run_plt_check,
remove_plt, run_succ_typings, local_fun_same_as_callback,
- bad_dialyzer_attr, merge_plts].
+ bad_dialyzer_attr, merge_plts, bad_record_type].
build_plt(Config) ->
OutDir = ?config(priv_dir, Config),
@@ -369,6 +369,32 @@ create_plts(Mod1, Mod2, Config) ->
%% End of merge_plts().
+bad_record_type(Config) ->
+ PrivDir = ?config(priv_dir, Config),
+ Source = lists:concat([bad_record_type, ".erl"]),
+ Filename = filename:join(PrivDir, Source),
+ PltFilename = dialyzer_common:plt_file(PrivDir),
+
+ Opts = [{files, [Filename]},
+ {check_plt, false},
+ {from, src_code},
+ {init_plt, PltFilename}],
+
+ Prog = <<"-module(bad_record_type).
+ -export([r/0]).
+ -record(r, {f = 3 :: integer()}).
+ -spec r() -> #r{f :: atom()}.
+ r() ->
+ #r{}.">>,
+ ok = file:write_file(Filename, Prog),
+ {dialyzer_error,
+ "Analysis failed with error:\n" ++ Str} =
+ (catch dialyzer:run(Opts)),
+ P = string:str(Str,
+ "bad_record_type.erl:4: Illegal declaration of #r{f}"),
+ true = P > 0,
+ ok.
+
erlang_beam() ->
case code:where_is_file("erlang.beam") of
non_existing ->