diff options
author | Hans Bolinder <[email protected]> | 2016-10-21 09:16:34 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-10-21 09:16:34 +0200 |
commit | 055b1b09537b8900489d28ba37078edd7be57d04 (patch) | |
tree | e4502144f074bf226f110fcbb6409f1e0785ab37 /lib/dialyzer/test/plt_SUITE.erl | |
parent | ad2c3de34f2452378b5c550ddc0795a1fe6efe4c (diff) | |
parent | 56b3298377c7422345076f342c0d99901aee34fc (diff) | |
download | otp-055b1b09537b8900489d28ba37078edd7be57d04.tar.gz otp-055b1b09537b8900489d28ba37078edd7be57d04.tar.bz2 otp-055b1b09537b8900489d28ba37078edd7be57d04.zip |
Merge branch 'fishcakez/dialyzer/fix_attribute_bug/ERL-283/OTP-13979' into maint
* fishcakez/dialyzer/fix_attribute_bug/ERL-283/OTP-13979:
dialyzer: Fix error handling of bad -dialyzer() attributes
Diffstat (limited to 'lib/dialyzer/test/plt_SUITE.erl')
-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 6ebe23b54b..460d4e2240 100644 --- a/lib/dialyzer/test/plt_SUITE.erl +++ b/lib/dialyzer/test/plt_SUITE.erl @@ -8,13 +8,15 @@ -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]). + remove_plt/1, run_plt_check/1, run_succ_typings/1, + bad_dialyzer_attr/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]. + remove_plt, run_succ_typings, local_fun_same_as_callback, + bad_dialyzer_attr]. build_plt(Config) -> OutDir = ?config(priv_dir, Config), @@ -249,6 +251,30 @@ remove_plt(Config) -> {init_plt, Plt}] ++ Opts), ok. +bad_dialyzer_attr(Config) -> + PrivDir = ?config(priv_dir, Config), + + Prog1 = <<"-module(dial). + -dialyzer({no_return, [undef/0]}).">>, + {ok, Beam1} = compile(Config, Prog1, dial, []), + Plt = filename:join(PrivDir, "bad_attr.plt"), + {dialyzer_error, + "Analysis failed with error:\n" + "Could not scan the following file(s):\n" + " Unknown function undef/0 in line " ++ _} = + (catch run_dialyzer(plt_build, [Beam1], [])), + + Prog2 = <<"-module(dial). + -dialyzer({no_return, [{undef,1,2}]}).">>, + {ok, Beam2} = compile(Config, Prog2, dial, []), + {dialyzer_error, + "Analysis failed with error:\n" + "Could not scan the following file(s):\n" + " Bad function {undef,1,2} in line " ++ _} = + (catch run_dialyzer(plt_build, [Beam2], [])), + + ok. + compile(Config, Prog, Module, CompileOpts) -> Source = lists:concat([Module, ".erl"]), PrivDir = ?config(priv_dir,Config), |