diff options
author | Hans Bolinder <[email protected]> | 2017-11-14 10:21:59 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-11-14 10:21:59 +0100 |
commit | 8eb324ba0b7e8bc70640a6d9258aac5a7f7be2a6 (patch) | |
tree | 718a626feb9d90e4a77207397e875ff870ea7454 /lib/dialyzer/test | |
parent | 19245b1ac7bf881319950adb973ff2ce24fea23e (diff) | |
parent | 8c42d5dc4f85d540c53cf24c85de6372c89ec486 (diff) | |
download | otp-8eb324ba0b7e8bc70640a6d9258aac5a7f7be2a6.tar.gz otp-8eb324ba0b7e8bc70640a6d9258aac5a7f7be2a6.tar.bz2 otp-8eb324ba0b7e8bc70640a6d9258aac5a7f7be2a6.zip |
Merge branch 'maint'
* maint:
dialyzer: Display error messages without call stack
Diffstat (limited to 'lib/dialyzer/test')
-rw-r--r-- | lib/dialyzer/test/plt_SUITE.erl | 30 |
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 -> |