diff options
author | Hans Bolinder <[email protected]> | 2017-11-14 10:12:12 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-11-14 10:12:12 +0100 |
commit | 8c42d5dc4f85d540c53cf24c85de6372c89ec486 (patch) | |
tree | 41c012d77562b22f0f159be9d81f4354e4d0db3b | |
parent | cde4ddc0494c9cdc8169dbc552e0e9b91c3a1b30 (diff) | |
parent | ffd24a6d63b94c8871dc718204bc2cf805ceba73 (diff) | |
download | otp-8c42d5dc4f85d540c53cf24c85de6372c89ec486.tar.gz otp-8c42d5dc4f85d540c53cf24c85de6372c89ec486.tar.bz2 otp-8c42d5dc4f85d540c53cf24c85de6372c89ec486.zip |
Merge branch 'hasse/dialyzer/fix_crash_msg/OTP-14742' into maint
* hasse/dialyzer/fix_crash_msg/OTP-14742:
dialyzer: Display error messages without call stack
-rw-r--r-- | lib/dialyzer/src/dialyzer_analysis_callgraph.erl | 6 | ||||
-rw-r--r-- | lib/dialyzer/test/plt_SUITE.erl | 30 |
2 files changed, 33 insertions, 3 deletions
diff --git a/lib/dialyzer/src/dialyzer_analysis_callgraph.erl b/lib/dialyzer/src/dialyzer_analysis_callgraph.erl index a4b42c9367..9993c68fed 100644 --- a/lib/dialyzer/src/dialyzer_analysis_callgraph.erl +++ b/lib/dialyzer/src/dialyzer_analysis_callgraph.erl @@ -165,7 +165,11 @@ analysis_start(Parent, Analysis, LegalWarnings) -> remote_type_postprocessing(TmpCServer, Args) -> Fun = fun() -> - exit(remote_type_postproc(TmpCServer, Args)) + exit(try remote_type_postproc(TmpCServer, Args) of + R -> R + catch + throw:{error,_}=Error -> Error + end) end, {Pid, Ref} = erlang:spawn_monitor(Fun), dialyzer_codeserver:give_away(TmpCServer, Pid), 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 -> |