diff options
author | Hans Bolinder <[email protected]> | 2018-05-21 11:50:11 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2018-05-21 11:50:11 +0200 |
commit | 48f2d66707330667c6d3e268466b5440d1b930ab (patch) | |
tree | c5fa1913da5de3e2fa0b8df976b63b9f22d0586b /lib/dialyzer/test | |
parent | f03603762806ac96cdca4a2c4f3b2b8b3190741a (diff) | |
parent | ac35ee08779884728d67d804cc80b0c210c29fd8 (diff) | |
download | otp-48f2d66707330667c6d3e268466b5440d1b930ab.tar.gz otp-48f2d66707330667c6d3e268466b5440d1b930ab.tar.bz2 otp-48f2d66707330667c6d3e268466b5440d1b930ab.zip |
Merge branch 'hasse/dialyzer/funs_in_dead_code/OTP-15079/ERL-593'
* hasse/dialyzer/funs_in_dead_code/OTP-15079/ERL-593:
dialyzer: Do not emit warnings for unreachable funs
Diffstat (limited to 'lib/dialyzer/test')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/results/unused_funs | 5 | ||||
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/unused_funs.erl | 21 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/unused_funs b/lib/dialyzer/test/small_SUITE_data/results/unused_funs new file mode 100644 index 0000000000..c468457ead --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/unused_funs @@ -0,0 +1,5 @@ + +unused_funs.erl:10: The pattern 'error' can never match the type 'other_error' +unused_funs.erl:15: Function not_used/0 will never be called +unused_funs.erl:19: Function foo/1 will never be called +unused_funs.erl:7: Function test/0 has no local return diff --git a/lib/dialyzer/test/small_SUITE_data/src/unused_funs.erl b/lib/dialyzer/test/small_SUITE_data/src/unused_funs.erl new file mode 100644 index 0000000000..c24cf3ea81 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/unused_funs.erl @@ -0,0 +1,21 @@ +%% See also ERL-593. + +-module(unused_funs). + +-export([test/0]). + +test() -> % "has no local return" + Var = outer_scope, + case other_error of + error -> % "can never match" + %% No warnings "no local return" and "_ = 1 can never match 0" (!) + foo(fun() -> {Var, 1 = 0} end) + end. + +not_used() -> % "will never be called" + %% No warnings "no local return" and "1 can never match 0". + foo(fun() -> 1 = 0 end). + +foo(Fun) -> % "will never be called" + 1 = 0, % No pattern match warning (foo/1 is not traversed at all). + Fun(). |